Introduction*toComputerUseinPhysics

[Pages:12]Introduction to Computer Use in Physics

V. Erkcan ?zcan

Boazi?i ?niversitesi

Phys 290 - Fall 2016 - Lecture Slides - September 27-28

PHYS290 - V. E. ?zcan

Question

Colossus was the first large-scale electronic computer.

It was used to break the German Lorenz Cipher during WW2. On the left, we see the teleprinter alphabet used (taken from ) How many bits were being used in this character set? When xx?xx was entered, the meanings of the code would change, until a xxxxx was entered. Could we model this "feature" as an extra bit?

2

Where do all these programs reside?

The OS and the compilers are rather sizeable programs. It is not possible to keep all their components and the large amounts of data on the memory. Moreover fast memory needs constant electrical power; we need more permanent media for storage.

As the computer boots up, BIOS (or something similar like UEFI), which is located on non-volatile memory (firmware), takes the first role. It reads the available hard drives (or the DVD or the USB, etc.) and copies starting parts of the OS (boot record) into the memory. The boot record starts running and handles the rest, copying the relevant parts of the OS onto the memory.

PHYS290 - V. E. ?zcan

BIOS = Basic Input/Output System

3

UEFI = Unified Extensible Firmware Interface

Hard Drive Organization

The data are recorded on to disks as strings of 0s and 1s, just like memory. However we also need a way to keep track of where any given piece of data starts on the disk and where they end. There are a variety of ways of doing that task, these ways are called file systems.

Examples: FAT, NTFS, ext3, HFS, etc.

The OS is responsible for the use of the hard drive through a particular file system. Sometimes a certain OS might be unaware of the file system used by another OS.

Sometimes it becomes difficult to move from one OS to another OS, as you get locked-in to a particular filesystem, as it is undocumented (no source code, no proper description of the FS). For example in order to reinvent the code for reading from and safely writing onto NTFS disks, people had to do a lot of reverse engineering.

PHYS290 - V. E. ?zcan

4

Folders

The filesystem keeps track of each file on a disk; but we humans have difficulty keeping track of our files when there are hundreds or thousands of them. In order to facilitate handling them, we "put" them in folders.

On a disk, the OS does not have to create any special regions for generic folders: the folders are much like names of files. The folders are really for human consumption, for us to keep our files organized.

In OSes with graphical user interfaces (GUI) the desktop we see in

front of us when the computer is running is also a folder. The OS

simply shows all the contents of that folder automatically on the

screen.

PHYS290 - V. E. ?zcan

In some UNIX-like OSes, like Linux, Solaris, BSD,

etc., certain pieces of data that are not really on a

disk are also presented to the enduser in the form

5

of files on special folders (ex. /proc folder).

How to write our own programs?

We have our OS running our computer, and we have the needed compilers and/or interpreters. How do we go about writing our own programs?

Have a clean folder to keep your work. Come up with a reasonable logical structure for yourself. (For example: ~/work/phys290/hw1/) Keep your working folder tidy. Name your files in a sensible manner. (not a1.cxx, fourierTransform.cxx)

Search the web for possible solutions; and/or talk to your peers.

If you find a piece of code that might be useful, first MAKE SURE YOU UNDERSTAND it, then copy and paste. Fill the missing parts gradually. While copying make sure you follow the software licenses. In your code document what you are doing; mention the website, write your thoughts, etc.

When you use the compiler, if the gives errors, carefully read the FIRST error. If you don't understand what it means, search on the web. Repeat one by one from the FIRST to the next until all the errors have been handled. DON'T EVER LOOSE HOPE, BE PATIENT!

Run the compiled program. If it does not work as expected, add various print-out commands all around the code and try to identify the first part of the code which is behaving strangely. BE PATIENT! (cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download