motivation laboratory work in tddi04
play

Motivation Laboratory work in TDDI04 Operating systems are nearly - PDF document

Motivation Laboratory work in TDDI04 Operating systems are nearly Introduction to Pintos everywhere Crucial piece of software Assignments 00, 0, 1 Perform concurrent tasks Viacheslav Izosimov Synchronization 2009-02-02 C is the main


  1. Motivation Laboratory work in TDDI04 Operating systems are nearly Introduction to Pintos everywhere Crucial piece of software Assignments 00, 0, 1 Perform concurrent tasks Viacheslav Izosimov Synchronization 2009-02-02 C is the main viaiz@ida.liu.se language for real operating systems! Motivation Outline 1000000-5000000 LOC General questions Nearly the first experience with a Introduction to Pintos relatively large piece of General description of labs software Lab rules General algorithm for completing the labs Direct jump from 1000 to Lab 0 1000000 can be too difficult! Setting up the program environment Debugging of Pintos 5000-10000 LOC Lab 1 Pintos kernel and command line up to 1000 LOC Execution of user programs in Pintos Argument passing to the user programs Synchronization Your programs so far. Pintos. Real systems. C pointers and address arithmetics General questions Introduction to Pintos Shift from Nachos (1990s) to Pintos (2004) Lab lessons: Labs: More lessons than the last year! Pintos is the most up-to-date “toy operating” system Groups of two students Exercises during lessons Can boot as a real operating system Sign up as soon as possible! No quizzes Answer on the preparatory questions Code is not as “messy” as in Nachos before implementing anything! Pure C implementation Have your design ready Install on Sun machines during Lab #0 before implementation! Pintos Extend during Lab #1 − #5 Work jointly! No cheating! 1

  2. Introduction to Pintos Introduction to Pintos Runs on x86 machine QEMU – a computer system emulator is used User memory User programs UNIX environment User stack C implementation Threads (both Kernel Kernel stack and user programs) Scheduler Synchronization User-exception handler primitives Memory management Not complete… Interrupt handler File system Your task! Timer General Description of Labs General Description of Labs Lab 00: “Introduction to C Programming” Lab 2: “System calls” System calls Checks your ability to complete the labs Single user program Lab 0: “Introduction and installation” Console Introductory lab, where you need to setup your program Lab 3: “ Memory management, securing the system calls” environment and try out debugging Memory management & security issues Lab 1: “Setting Up the Program Stack and Starting the First User Program” Lab 4: “Execution, termination and synchronization of user programs” Learn how operating system kernel operates Handling program arguments User program & arguments passing Execution of several user programs Simple synchronization tasks Termination of a user program This lab is essential for the work on later labs and Synchronization of shared data structures understanding of PintOS Wait system call General Description of Labs Lab Rules Lab 5: “File system” Every member of the group participate equally and every member should be able to answer Synchronization of read-write operations questions related to labs Before doing the lab answer on preparatory questions on the lab page Understand first, then implement Try to find ”bugs” yourself at first No copying of source code from any sources, no cheating But before… Pass assignments on time! 2

  3. General Algorithm to Complete the Labs Lab Rules 1. Answer on all preparatory questions! Pass assignments on time! 2. Understand what you are supposed to do (read instructions carefully ) Preliminary “self-control” schedule 3. Discuss all the issues with your lab partner to make sure Lab 00, 0 – Friday! that he/she also understands (That’s you future help !) Lab 1 – 13 th of February 4. Understand the source code, which you are supposed to understand Lab 2 – 25 th of February 5. Begin implementation! Lab 3 – 4 th of March 6. Document carefully what you are doing ( put date, name Lab 4 – 1 st of April and short description around each new piece of code) Lab 5 – 8 th of May 7. Work hard … and not only during lab hours, they are mostly for asking questions from lab assistants FINAL DEADLINE – 15 th of May Lab 00 Lab 0 You will need to debug a small program “debugthis.c” Set up the program environment (don’t forget!) with DDD after compiling it with GCC (not CC!) module initadd ~TDDI04/labs2008/modules/pintos module add ~TDDI04/labs2008/modules/pintos Create a linked list Learn how to browse the source code Check if you have correct version of GCC and GDB module list GCC should be 3.4.x and you will know if GDB version If you are not able to complete the lab, then you should is correct after completing Lab 00 focus on C before you proceed further or even consider to take the course next year. No formal pass/fail or other Copy Pintos to your directory regulations though… gzip -cd ~TDDI04/labs2008/pintos_ida.tar.gz | tar xvf - Lab 0 Lab 0 You will have the following structure of directories Compile and build Pintos pintos/src cd pintos/src/threads devices gmake examples Test if Pintos works filesys cd build lib pintos --qemu -- run alarm-multiple misc tests threads userprog utils vm 3

  4. Lab 0 Lab 0 cd ~/pintos/src/ Debugging (from build ) gmake -C examples To debug pintos you need two terminals. One to run gmake -C userprog pintos and one to run the debugger: cd userprog/build pintos --qemu --gdb -- run testname ddd --gdb --debugger pintos-gdb kernel.o& pintos-mkdisk fs.dsk 2 pintos -v -p ../../examples/sumargv -a sumargv -- -f -q run sumargv Lab 0 Pintos Disk (1) Dealing with Pintos disk Instead of the normal pintos command you run the command debugpintos : In “userprog/build”: pintos-mkdisk fs.dsk 2 cd ??/build debugpintos -v -p This will create a file fs.dsk with a 2MB simulated disk in ../../examples/sumargv -a sumargv -- the directory. -f -q run sumargv Format: pintos --qemu -- -f -q . It will prepare pintos as usual, but stop and wait for the Copy user programs: debugger to connect. In the debug terminal, run: pintos --qemu - p programname -- -q cd ??/build pintos-gdb kernel.o with new name It starts gdb configured for pintos. In the debugger, enter pintos --qemu - p programname -a newname -- -q the commands: debugpintos break main continue quit Pintos Disk (2) Lab 1 Dealing with Pintos disk Learn how operating system kernel operates Example: Initialization pintos --qemu - p ../../examples/ sumargv Starting of the user program -a severe_student_program -- -q De-initialization To copy a file from the disk: pintos --qemu - g programname -- -q User program & arguments passing or The first user program pintos --qemu - g programname -a newname -- -q Simple synchronization tasks * - p = put, - g = get Semaphores, Locks, Conditions To run: pintos --qemu -- run programname This lab is essential for the work on later labs Example: and understanding of PintOS pintos --qemu -- run severe_student_program Synchronization mechanisms 4

  5. Lab 1 Lab 1 Your task is to study Pintos kernel and implement Understand the source code in loading of the first user program and argument threads/init.c passing threads/synch.[h|c] threads/synchlist.[h|c] Argument passing is mostly about address threads/thread.[h|c] arithmetics and learning the general structures userprog/process.[h|c] used in the kernel contains a skeleton of your There are two alternative implementations of the implementations synchronization during the loading: with Semaphores with Locks/Conditions Lab 1::Threads (1) Lab 1::Threads (2) ������������������������������� A system contains several threads running in parallel � ��� ���� Thread is a “basic unit of CPU utilization” ������������������������������� § Thread ID ������������������� ��������� ������!"��#�����������#������ § A program counter ������$%������� Entering SimpleTest & § A register set & *** thread 0 looped 0 times § A stack *** thread 1 looped 0 times �������������������!������� *** thread 0 looped 1 times � Thread 1 *** thread 1 looped 1 times �������$�����������'����������� … ��������(������)���������!���� Thread 2 ������$��������$����#�*+,$-,.#�������������#���������/�� Thread execution sequence ������������������������ & Lab 1::Kernel Lab 1::Kernel 5

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend