Operating System Concepts: Process Synchronization, Memory Management, and File Systems, Exams of Operating Systems

Various topics in operating systems, including process synchronization using message passing, process scheduling algorithms, memory management using different partitioning schemes, and file system concepts such as block sizes, disk addresses, and free list management. It also includes examples and problems to solve.

Typology: Exams

Pre 2010

Uploaded on 08/16/2009

koofers-user-6rq-2
koofers-user-6rq-2 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 540 - Operating Systems - Final Exam - Name:
Date: Wenesday, May 12, 2004
Part 1: (78 p oints - 3 points for each problem)
( C ) 1. In UNIX a utility which reads commands from a terminal is called:
(A) Terminal handler (B) Kernel (C) Command interpreter (D) None of the above
( A ) 2. Which scheduler is responsible for controlling the degree of multiprogramming?
(A) Memory scheduler (B) Admission scheduler (C) CPU scheduler (D) None of the above
( B ) 3. Which statement about user-level threads and kernel threads is false?
(A) Both user-level and kernel threads share the code and data.
(B) Both user-level and kernel threads share their registers and stack.
(C) User-level thread scheduling is faster than kernel thread scheduling.
(D) None of the above
( D ) 4. Which is not able to solve the race condition?
(A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory
( C ) 5. Which is not the requirement of a solution to the critical-section problem?
(A) Mutual Exclusion (B) Progress (C) Busy Waiting (D) Bounded Waiting
( B ) 6. In which environment is preemption essential?
(A) Batch (B) Interactive (C) Real time (D) None of the above
( D ) 7. Which is not a CPU scheduling criterion?
(A) CPU utilization (B) Throughput (C) Response time (D) Burst time
( A ) 8. Which is not a preemptive scheduling?
(A) SJF (B) SRTN (C) RR (D) None of the above
( B ) 9. Which is not the necessary condition for a deadlock?
(A) Mutual exclusion (B) Starvation (C) Hold and wait (D) None of the above
( C ) 10. Which of the memory allocation schemes are subject to internal fragmentation?
(A) Segmentation (B) Multiple Contiguous Variable Partitions (C) Paging (D) None of the above
( C ) 11. In which case is trashing occurring?
(A) 13% CPU and 3% disk utilization (B) 87% CPU and 3% disk utilization
(C) 13% CPU and 97% disk utilization (D) None of the above
( D ) 12. The time to read or write a 32-bit memory word is 10 nsec. Assume the total holes take
one fifth of the 256 MB memory. What is the time needed to eliminate holes by compaction?
(A) 268.435 msec (B) 536.87 msec (C) 805.305 msec (D) 1073.74 msec
( B ) 13. A machine with 512 (29) MB memory has a 32-bit memory word. The frame size is 128 (27)
words. How many bits are used to indicate the frame number?
(A) 16 bits (B) 20 bits (C) 24 bits (D) None of the above
( D ) 14. A system with a 32-bit virtual address. It uses the first 20 bits to indicate the page
number. Each table entry takes 4 bytes. What is the size of the page table?
(A) 1 MB (B) 2 MB (C) 3 MB (D) 4 MB
( C ) 15. The dirty bit is used for the purpose of:
(A) Dynamic allocation of memory used by one process to another
(B) Implementing FIFO page replacement algorithm
(C) To reduce the average time required to service page faults
(D) None of the above
( A ) 16. Which page-replacement algorithm does not suffer from Belady’s anomaly?
(A) Least recently used (LRU) (B) Clock (C) First-In First-Out (FIFO) (D) None of the above
pf3
pf4
pf5

Partial preview of the text

Download Operating System Concepts: Process Synchronization, Memory Management, and File Systems and more Exams Operating Systems in PDF only on Docsity!

CS 540 - Operating Systems - Final Exam - Name: Date: Wenesday, May 12, 2004

Part 1: (78 points - 3 points for each problem)

( C ) 1. In UNIX a utility which reads commands from a terminal is called: (A) Terminal handler (B) Kernel (C) Command interpreter (D) None of the above

( A ) 2. Which scheduler is responsible for controlling the degree of multiprogramming? (A) Memory scheduler (B) Admission scheduler (C) CPU scheduler (D) None of the above

( B ) 3. Which statement about user-level threads and kernel threads is false? (A) Both user-level and kernel threads share the code and data. (B) Both user-level and kernel threads share their registers and stack. (C) User-level thread scheduling is faster than kernel thread scheduling. (D) None of the above

( D ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory

( C ) 5. Which is not the requirement of a solution to the critical-section problem? (A) Mutual Exclusion (B) Progress (C) Busy Waiting (D) Bounded Waiting

( B ) 6. In which environment is preemption essential? (A) Batch (B) Interactive (C) Real time (D) None of the above

( D ) 7. Which is not a CPU scheduling criterion? (A) CPU utilization (B) Throughput (C) Response time (D) Burst time

( A ) 8. Which is not a preemptive scheduling? (A) SJF (B) SRTN (C) RR (D) None of the above

( B ) 9. Which is not the necessary condition for a deadlock? (A) Mutual exclusion (B) Starvation (C) Hold and wait (D) None of the above

( C ) 10. Which of the memory allocation schemes are subject to internal fragmentation? (A) Segmentation (B) Multiple Contiguous Variable Partitions (C) Paging (D) None of the above

( C ) 11. In which case is trashing occurring? (A) 13% CPU and 3% disk utilization (B) 87% CPU and 3% disk utilization (C) 13% CPU and 97% disk utilization (D) None of the above

( D ) 12. The time to read or write a 32-bit memory word is 10 nsec. Assume the total holes take one fifth of the 256 MB memory. What is the time needed to eliminate holes by compaction? (A) 268.435 msec (B) 536.87 msec (C) 805.305 msec (D) 1073.74 msec

( B ) 13. A machine with 512 (2^9 ) MB memory has a 32-bit memory word. The frame size is 128 (2^7 ) words. How many bits are used to indicate the frame number? (A) 16 bits (B) 20 bits (C) 24 bits (D) None of the above

( D ) 14. A system with a 32-bit virtual address. It uses the first 20 bits to indicate the page number. Each table entry takes 4 bytes. What is the size of the page table? (A) 1 MB (B) 2 MB (C) 3 MB (D) 4 MB

( C ) 15. The dirty bit is used for the purpose of: (A) Dynamic allocation of memory used by one process to another (B) Implementing FIFO page replacement algorithm (C) To reduce the average time required to service page faults (D) None of the above

( A ) 16. Which page-replacement algorithm does not suffer from Belady’s anomaly? (A) Least recently used (LRU) (B) Clock (C) First-In First-Out (FIFO) (D) None of the above

( B ) 17. When inverted paging is used, there is/are: (A) One global page table sorted by process id (B) One global page table sorted by the frame number (C) One global page table sorted by the virtual address (D) Page tables for each process sorted by the frame number

( A ) 18. Where is the partition table stored? (A) Master Boot Record (MBR) (B) Boot block (C) Superblock (D) None of the above

( D ) 19. The UNIX system identifies a file as an executable binary file by (A) File name (B) File extension (C) File descriptor (D) Magic number in the file header

( A ) 20. A file system checker found the file count is larger than the i-node count. What does this mean? (A) A link to the file is not counted. (B) This problem is not serious. (C) The i-node points to some file that no longer exists. (D) None of the above

( C ) 21. Which statement about hard and soft links is false? (A) Hard links do not require any extra disk space. (B) Symbolic links need space to store the name of the file pointed to. (C) Hard links can point to files in other disk partitions. (D) None of above

( A ) 22. Consider a disk with a mean seek time of 8 msec, a rotational rate of 12,000 rpm, and 524, bytes per track. What is the average access time for block sizes of 8 KB? (A) 10.578 msec (B) 11.094 msec (C) 11.61 msec (D) None of the above

( B ) 23. A file system uses 24-bit disk addresses with the block size 4 KB. What is the maximum partition size? (A) 32 GB (B) 64 GB (C) 128 GB (D) 256 GB

( B ) 24. A disk use 24-bit disk addresses. What is the percentage of disk space that must be free so that the free list uses less space than the bit map? (A) 3.125% (B) 4.167% (C) 6.25% (D) None of the above

( D ) 25. A file system with the hit ratio 0.4 takes 1 msec to satisfy a request from cache, but 21 msec if a disk read is needed. What is the mean time to satisfy a request? (A) 10 msec (B) 11 msec (C) 12 msec (D) 13 msec

( C ) 26. Which is an example of public-key cryptography? (A) Caesar cipher (B) AES (C) PGP (D) None of the above

( A ) 27. Which is a threat to data integrity? D (A) Tampering with data (B) Exposure of data (C) Denial of service (D) None of above

Part 2: (122 points)

  1. (a) (6 points) What is a process? Describe the process state. (b) (6 points) What is a thread? Give two benefits of using threads.

(a) A process is a running program. running: Instructions are being executed. ready: The process is waiting to be assigned to a process. blocked: The process is waiting for some event to occur.

(b) A thread is a lightweight process and a basic unit of CPU.

  • Responsiveness: Multiple activities can be done at same time. They can speed up the appli- cation.
  • Resource Sharing: Threads share the memory and the resources of the process to which they belong.

Process C:

read(mbox1, msg) /* Block until A and B finished / read(mbox1, msg) / Block until B and B finished */

  • do work of C write(mbox3, msg); /* Let E start */

Process D:

read(mbox2, msg) /* Block until B finished */

  • do work of D write(mbox3, msg); /* Let E start */

Process E:

read(mbox3, msg) /* Block until C and D finished / read(mbox3, msg) / Block until C and D finished */

  • do work of E
  1. (12 points) Suppose that the following processes arrive for execution at time 0 in the order A, B, C:

Process Run Time Priority A 2 1=low B 4 3=high C 3 2

(a) Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a non- preemptive priority (a smaller priority number implies a lower priority), and RR (quantum = 2) scheduling. (b) What is the waiting time of each process for each of the scheduling algorithms? (c) What is the turnaround time of each process for each of the scheduling algorithms?

(a) The four Gantt charts are 0 2 6 9 0 2 5 9 +--+----+---+ +--+---+----+ |A | B | C | FCFS | A| C | B | SJF +--+----+---+ +--+---+----+

0 4 7 9 0 2 4 6 8 9 +----+---+--+ +--+--+--+--+-+ | B | C | A| Priority |A | B| C| B|C| RR +----+---+--+ +--+--+--+--+-+

(b) Waiting time: | FCFS | SJF | Priority | RR ---+------+-----+----------+---- A | 0 | 0 | 7 | 0 B | 2 | 5 | 0 | 4 C | 6 | 2 | 4 | 6

(c) Turnaround time: | FCFS | SJF | Priority | RR ---+------+-----+----------+---- A | 2 | 2 | 9 | 2 B | 6 | 9 | 4 | 8 C | 9 | 5 | 7 | 9

  1. (10 points) P is a set of processes. R is a set of resources. E is a set of request or assignment edges. The sets P, R, and E are as follows: P = {P 1 , P 2 , P 3 } R = {R 1 , R 2 , R 3 } E = {P 1 → R 1 , P 1 → R 2 , P 2 → R 2 , P 2 → R 3 , P 3 → R 3 , R 1 → P 2 , R 2 → P 3 , R 3 → P 1 } R 1 has one instance. R 2 has one instances. R 3 has two instances.

(a) Draw the resource-allocation graph. (b) Is there any deadlock in this situation? Briefly Explain.

(a) See the graph. (b) Consider the resource-allocation graph. There is a cycle in the system. P2 and P3 all request R3. If P3 gets it, P3 will release R2 and R3 after P3 finishes. It won’t lead to the deadlock.

  1. (12 points) Given memory partitions of 200 KB, 400 KB, 100 KB, and 500 KB (in order). How would each of the first-fit, next-fit, best-fit, and worst-fit algorithms place processes of 360 KB, 290 KB, 100 KB, and 200 KB (in order)?

First fit : (a) 400 KB (b) 500 KB (c) 200 KB (D) remainder of 500 KB Next fit : (a) 400 KB (b) 500 KB (c) remainder of 500 KB (d) 200 KB Best fit : (a) 400 KB (b) 500 KB (c) 100 KB (d) 200 KB Worst fit : (a) 500 KB (b) 400 KB (c) 200 KB (d) Not fit

  1. (12 points) A small computer has five page frames. At the first clock tick, the R bits are 10101 (page 1 and 3 are 0). A subsequent clock ticks, the values are 10100, 10101, 10101, 01101, 01011, and 11001. If the aging algorithm is used, with a 4-bit counter, give the values of the counters after the last tick. Which page would be selected to be removed from memory?

(a) R bits Page 0 Page 1 Page 2 Page 3 Page 4 10101 1000 0000 1000 0000 1000 10100 1100 0000 1100 0000 0100 10101 1110 0000 1110 0000 1010 10101 1111 0000 1011 0000 1101 01101 0111 1000 1101 0000 1110 01011 0011 1100 0110 1000 1111 11001 1001 1110 0011 0100 1111 (b) Page 2 has the smallest value. It will be evicted.

  1. (10 points) Consider a computer is equipped with associative memory that can hold 16 entries of the page table and can be accessed in 10 nanoseconds. The CPU takes total 90 nanoseconds to search the page entry and access a data item when the page entry is in the associative memory.

(a) Find a formula that expresses the effective access time as a function of the hit ratio (h). (b) What hit ratio is needed to achieve the effective access time of 105 nanoseconds?

(a) Let E = associative memory lookup time, T = memory cycle time, h = hit ratio. E + T = 90, E = 10 ⇒ T = 80. E + 2 × T = 170 Effective Access Time (EAT) = 90 × h + (1 - h) × 170 = 90 × h + 170 - 170 × h = 170 - 80 × h (b) 170 - 80 × h ≤ 102, 80 × h ≥ 170 - 102, 80 × h ≥ 68, h ≥ 85%