next up previous
Next: About this document ...

Ceng 328 Operating Systems
Midterm
April 7, 2006 10.40-12.30
Good Luck!
Part A. Short Answer, answer the questions with one or two sentences (each 5 pt)
  1. Discuss and compare
    i
    Single Programming,
    ii
    Pure Multiprogramming,
    iii
    Multiprogramming.
    .





  2. What is the purpose of the command interpreter? Why is it usually separate from the kernel?





  3. For each of the following system calls, give a condition that causes it to fail: fork and exec.





  4. A computer has six tape drives, with n processes competing for them. Each process may need two drives. For which value of n is the system deadlock free? Part B. Not Short Answer, you may answer the questions more than two sentences (each 7.5 pt)
  5. An operating system runs in privileged mode, a hardware state where it has full access to machine resources. Why is such a mode needed, and why can't normal user processes and threads enter privileged mode?






  6. What advantages do threads have over multiple processes? Suggest one application that would benefit from the use of threads?







  7. What is a race condition?






  8. What is a Critical Region? List and explain the four conditions that need to be satisfied to solve the critical-region problem?
  9. Does the busy waiting solution using the turn variable (strict alternation) work when the two processes are running on a shared-memory multiprocessor, that is, two CPUs, sharing a common memory?




  10. What is meant by the term context switch? What might cause a context switch to occur?









  11. What is starvation, give an example?




  12. Three jobs (A, B, and C) arrive to the job scheduler at time 0. Job A needs 10 seconds of CPU time, Job B needs 20 seconds, and Job C needs 30 seconds.
    a
    What is the average turnaround time for the jobs, assuming a shortest-job-first (SJF) scheduling policy?
    b
    What is the average turnaround time assuming a longest-job-first (LJF) policy?
    c
    Which finishes first, Job C in SJF or Job A in LJF?
  13. Describe the priority scheduling algorithm. Discuss what issues need to be consider to achieve good performance from this algorithm.














  14. Describe four ways to prevent deadlock by attacking the conditions required for deadlock. Part C. (each 15 pt)
  15. The Readers and Writers Problem models access to a database with many competing processes wishing to read and write it. It is acceptable to have multiple processes reading the database at the same time, but if one process is updating (writing) the database, no other processes may have access to the database, not even readers. Write pseudo code to coordinate the readers and writers.
    Hints: Need a global counter, rc, for the number of processes reading or wanting to. Use 2 semaphores - one for controlling access to rc, one for controlling access to the database.



next up previous
Next: About this document ...
Cem Ozdogan 2007-03-28