Presentation is loading. Please wait.

Presentation is loading. Please wait.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.1 Operating System Concepts Operating Systems Lecture 18 Midterm Review.

Similar presentations


Presentation on theme: "Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.1 Operating System Concepts Operating Systems Lecture 18 Midterm Review."— Presentation transcript:

1 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.1 Operating System Concepts Operating Systems Lecture 18 Midterm Review

2 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.2 Operating System Concepts Types of Questions to Expect Short answer  Define terms  Diagrams (e.g. process states)  List components/types (e.g. PCB components, types of process communication, etc).  Etc. Essays  Describe...  Compare different types of...  Describe advantages/disadvantages of...  Etc. Programming problems, etc. See topic list

3 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.3 Operating System Concepts Problem 1 Write the UNIX command line to pipe the output of the "ls -l" command to the "grep" command. grep should search for "myfile.cc". Redirect the output of grep to the file, "test.out".

4 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.4 Operating System Concepts Problem 2 Write a C++ program, readWrite.cc, that takes 2 arguments. The first argument is the name of an input file. The second argument is the name of an output file. The program should check that the correct number of arguments was entered. It should then read in a single integer from the input file and output it to the output file.

5 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.5 Operating System Concepts Problem 3 Write a C++ program in which the parent process forks two child processes. The second child should also fork a single child process (the grandchild of the parent). Each process should print its name to stdout (first child, second child, grandchild or parent).

6 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.6 Operating System Concepts Problem 4 Diagram the process tree produced by the following code. Label each process created with consecutive pid's starting with 1 (for the parent process). For each process, indicate the values of the variables, cpid, cpid2 and cpid3 after all the forks have been executed. int cpid = -1; int cpid2 = -1; int cpid3 = -1; cpid = fork( ); cpid2 = fork( ); if (cpid == 0) { cipd3 = fork( ); }

7 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.7 Operating System Concepts Problem 5 Write a C++ program to implement the following UNIX command line using a pipe: ls -l | grep myfile.txt

8 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.8 Operating System Concepts Problem 6 Use the SRTF (Shortest Time Remaining First) scheduling algorithm to answer the following. Suppose 4 processes arrive at the following times with the following burst times: ProcessArrival TimeBurst Time P 1 050 P 2 2020 P 3 2510 P 4 4024 a) Draw the Gantt diagram for these processes. b) Compute the following: Average Service Time, Throughput, Average Turnaround, Average Wait time.

9 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.9 Operating System Concepts Problem 7 Write a UNIX shell script to add together the first n integers and print the answer to the monitor. n should be given as an argument to the script.


Download ppt "Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 6.1 Operating System Concepts Operating Systems Lecture 18 Midterm Review."

Similar presentations


Ads by Google