|
IT-Programmet,
Tema 1 i termin 4:
TTIT61 Processprogrammering och Operativ System/Concurrent Programming and Operating Systems/Lab 0 - Pintos: Introduction and installation:Pintos is an instructional operating system that runs on x86 machines. You will run it in QEMU -- a computer system emulator, which runs as a user process under UNIX. Pintos is written in C. The lab assignments require modification of the provided version of Pintos by adding functionality to parts of it, for instance, synchronization of threads and memory management. InstallationFirst, set up necessary modules and paths by running the following commands: module initadd ~TTIT61/labs/modules/pintosand module add ~TTIT61/labs/modules/pintosThen, you will need to copy the Pintos files to your account on the IDA Sun workstations. Run the following command in a shell to install them in a sub-directory called pintos of your current directory: gzip -cd ~TTIT61/labs/pintos_ida.tar.gz | tar xvf -
Now you have the following (partially shown) path structure: pintos/src devices examples filesys lib misc tests threads userprog utils vm Primarilly you will work in Compilation
To compile Pintos for the first time, change your current directory to
the
gmake This will create Go down to the build directory and start Pintos to see that it runs: cd build pintos --qemu -- run alarm-multipleYou should get a new window with an output that ends with something similar to the following: astmatix <313> pintos --qemu -- run alarm-multiple Writing command line to /tmp/rCAZSDplHd.dsk... qemu -hda /tmp/rCAZSDplHd.dsk -m 4 -net none -nographic -monitor null Kernel command line: run alarm-multiple Pintos booting with 4,096 kB RAM... 374 pages available in kernel pool. 374 pages available in user pool. Calibrating timer... 2,454,400 loops/s. Boot complete. Executing 'alarm-multiple': (alarm-multiple) begin (alarm-multiple) Creating 5 threads to sleep 7 times each. (alarm-multiple) Thread 0 sleeps 10 ticks each time, (alarm-multiple) thread 1 sleeps 20 ticks each time, and so on. (alarm-multiple) If successful, product of iteration count and (alarm-multiple) sleep duration will appear in nondescending order. (alarm-multiple) thread 0: duration=10, iteration=1, product=10 (alarm-multiple) thread 1: duration=20, iteration=1, product=20 (alarm-multiple) thread 0: duration=10, iteration=2, product=20 (alarm-multiple) thread 0: duration=10, iteration=3, product=30 (alarm-multiple) thread 2: duration=30, iteration=1, product=30 (alarm-multiple) thread 0: duration=10, iteration=4, product=40 (alarm-multiple) thread 1: duration=20, iteration=2, product=40 (alarm-multiple) thread 3: duration=40, iteration=1, product=40 (alarm-multiple) thread 0: duration=10, iteration=5, product=50 (alarm-multiple) thread 4: duration=50, iteration=1, product=50 (alarm-multiple) thread 0: duration=10, iteration=6, product=60 (alarm-multiple) thread 1: duration=20, iteration=3, product=60 (alarm-multiple) thread 2: duration=30, iteration=2, product=60 (alarm-multiple) thread 0: duration=10, iteration=7, product=70 (alarm-multiple) thread 1: duration=20, iteration=4, product=80 (alarm-multiple) thread 3: duration=40, iteration=2, product=80 (alarm-multiple) thread 2: duration=30, iteration=3, product=90 (alarm-multiple) thread 4: duration=50, iteration=2, product=100 (alarm-multiple) thread 1: duration=20, iteration=5, product=100 (alarm-multiple) thread 3: duration=40, iteration=3, product=120 (alarm-multiple) thread 1: duration=20, iteration=6, product=120 (alarm-multiple) thread 2: duration=30, iteration=4, product=120 (alarm-multiple) thread 1: duration=20, iteration=7, product=140 (alarm-multiple) thread 2: duration=30, iteration=5, product=150 (alarm-multiple) thread 4: duration=50, iteration=3, product=150 (alarm-multiple) thread 3: duration=40, iteration=4, product=160 (alarm-multiple) thread 2: duration=30, iteration=6, product=180 (alarm-multiple) thread 3: duration=40, iteration=5, product=200 (alarm-multiple) thread 4: duration=50, iteration=4, product=200 (alarm-multiple) thread 2: duration=30, iteration=7, product=210 (alarm-multiple) thread 3: duration=40, iteration=6, product=240 (alarm-multiple) thread 4: duration=50, iteration=5, product=250 (alarm-multiple) thread 3: duration=40, iteration=7, product=280 (alarm-multiple) thread 4: duration=50, iteration=6, product=300 (alarm-multiple) thread 4: duration=50, iteration=7, product=350 (alarm-multiple) end Execution of 'alarm-multiple' complete. After that, you can stop the emulator by Ctrl+C combination or by closing
the simulator window.
After you change some files you will re-compile the local version of pintos
that exists in the current working directory (which will be DebuggingThe lab assignments are hard to debug without a debugger, in fact, in order to get help from the lab assistants you will have to use one. There is a debugger called "ddd" available which works fine with Pintos. It is a graphical interface on top of the "gdb" (the GNU debugger). To debug with DDD:
threads/builddirectory. Afterwards you can use DDD to set up brakepoints and continue execution until a breakepoint or until you press Ctrl+C inside DDD. Since few groups can be working on the same server, it might be a problem to use the same default port (1234) for debugging. Follow the instructions below to avoid this problem:
Try to to open and use debugger to make sure that it works. DocumentationThe most extensive information information available to you about Pintos can be found here. Hint: There is a lot of useful information to find in the comments of various .c and .h files. Read them! Next Laboratory workLaboratory Assignment 1 in which you will learn the basics of synchronization |
Sidansvarig: Sergiu Rafiliu
Senast uppdaterad: 2011-09-12
