Ecu Exam2 CSCI 4630 2012
Ecu Exam2 CSCI 4630 2012
EXAM # 1
Instructions
Please take a minute to read the instructions before beginning to answer the questions. This test consists of four questions spread over eleven pages, including this page. The total number of points for the whole test is 75. Points for individual questions are also indicated. The total time is 75 minutes. You may not consult your notes or books. However, you may use a crib sheet. You may use non-programmable calculators. Be sure to write your name. Show all intermediate steps for partial credit. Submit your crib sheet along with the exam, when you are done.
1. Select the most appropriate answer for each of the following questions. No need to provide any justication for your answer. You will get one and half points for each correct answer. You will get 0.5 points for each wrong answer. You will get 0 points for each no answer. (15 Pts.) (a) A process is: 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 (a) A program. (b) A program with a CPU allocated to it. (c) A program in execution. (d) An abstraction to represent data. (e) None of the above. (a) The interrupt vector. (b) An entry in the process table. (c) Registers. (d) An executable le. (e) CPU. (a) Ready to Running. (b) Running to Ready. (c) Blocked to Running. (d) Running to Blocked. (e) None of the above. (a) More than one user can use the system. (b) One user can run multiple programs. (c) Multiple programs can be run concurrently. (d) A program must be written by multiple users. (e) All of the above. (a) gears, wheels and cogs. (b) VLSI chips. (c) Integrated Circuits (d) Vaccum Tubes and Plugboards. (e) Transistors.
(f) Which of the following is NOT a per thread item : 2 2 2 2 2 (a) Program Counter (b) Registers (c) Open les (d) Stack (e) None of the above.
(g) which of the following is most accurate of the return value of a successful wait system call? 2 2 2 2 2 (a) pid of the parent process executing the call. (b) pid of the child that died. (c) An integer passed by the child process. (d) An error number. (e) pid of the init process.
(h) Which of the following is most accurate of the return value of a successful fork system call? 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 (a) zero in the parent, and childs process id in the child (b) zero in the child, and parents process id in the parent (c) childs process id in the parent and parents process id in the child (d) zero in the child, and childs process id in the parent (e) zero in the parent, and parents process id in the child (a) the thread itself. (b) the process to which the thread belongs. (c) the operating system. (d) the run-time system. (e) None of the above. (a) Maximize CPU eciency. (b) Minimize turnaround time. (c) Minimize throughput. (d) Ensure fairness. (e) Mnimize response time.
(i) When threads are implemented at the user level, the thread table is maintained by
2. Answer exactly eight the following ten questions in the space provided. Try to answer the question precisely (i.e., be up to the point). (8 * 5 = 40 pts.) (a) What are the two most important functions of an operating system?
(c) Mention some of the ways in which an operating system can be structured. Briey explain one of them.
(d) Name and describe the dierent states that a process can exist in at any given time.
(e) Most round robin schedulers use a xed size quantum. Give an argument in favor of a small quantum. Now give one in favor of a large quantum.
(f) Suppose the following for loop is executed by a process for (i=1;i <= 5;i++) fork(); How many processes will be created in total (including the parent process)? Explain your answer.
(g) Suppose the following for loop is executed by a process for (i=1; i<=5; i++) { printf("Hi"); execlp("foo","foo",NULL); printf("There"); } How many times will Hi be printed? How many times will There be printed? Explain your answer.
(h) What is the dierence between static priority and dynamic priority? What is the primary use of making priorities dynamic.
(i) Mention the most important advantage and most important disadvantage of implementing threads at the user level.
(j) When an interrupt occurs, immediately the hardware stacks the program counter. Why is this done? Why is this done by hardware instead of by software?
3. In this problem you are to compare reading a le using a single-threaded le server and a multithreaded server. It takes 15 msec to get request for work, dispatch it, and do the rest of the necessary processing, assuming the data needed are already in the block cache. If a disk operation is needed, as is the case one-third of the time, an additional 75 msec is required, during which time the thread is blocked. How many requests per second the server can handle if it is single threaded? How many, if it is multithreaded? Assume that you are dealing with a single CPU system. (10)
4. Five batch jobs A through E, arrive at a computer center at almost the same time (but in the order A, B, C, D, E). They have estimated running times of 8, 4, 2, 6, and 10 units. Their (externally determined) priorities are 3, 5, 2, 1, and 4, respectively, with 5 being the highest priority. For each of the following scheduling algorithms, determine the mean process turnaround time. Ignore the process switching overhead. All processes are completely CPU bound. (10 Pts.) (a) Shortest Job First: Assume that only one job at a time runs, until it nishes.
(b) First-Come First-Served: Assume that only one job at a time runs, until it nishes.
10
(c) Priority Scheduling: Assume that only one job at a time runs, until it nishes.
(d) Round Robin: Assume that the system is multiprogrammed and the time quantum is 1 unit.
11