CS FundamentalsVery hardGATE CS · Advanced
A system with 3 resource types has Available = (0, 0, 1) and 7 processes P0-P6. P0: Allocation (1, 1, 1), Request (1, 0, 0); P1: Allocation (0, 0, 1), Request (0, 0, 2); P2: Allocation (0, 2, 1), Request (0, 0, 0); P3: Allocation (1, 1, 0), Request (1, 0, 2); P4: Allocation (2, 0, 0), Request (2, 0, 0); P5: Allocation (0, 1, 0), Request (2, 0, 2); P6: Allocation (0, 1, 0), Request (0, 1, 0). The deadlock-detection algorithm (repeatedly let any process whose outstanding Request fits within Work finish and release its Allocation) is run. How many processes are deadlocked?
- A. 3
- B. 5
- C. 4
- D. 6
Correct answer: C. 4
Start with Work = Available, let every process whose request fits finish and add its allocation to Work, and repeat. The processes left unfinished (P0, P3, P4, P5) are deadlocked. Merely waiting for a resource right now (6 processes) is not the same as being deadlocked.
More Operating Systems questions
- A disk has cylinders 0-199. The head is at cylinder 96 and is moving towards higher numbers; the pending requests are for cylinders 21…
- A file system uses 2 KB blocks and 4-byte block pointers. Each inode has 12 direct pointers plus one single-, one double- and one…
- A 32-bit machine uses two-level paging with 4 KB pages and 4-byte entries (10 bits for the top level, 10 for the second level, 12 for the…
- A paged system has a 10 ns TLB lookup and 100 ns per memory access, with a 95% TLB hit ratio. A TLB miss costs a two-level page-table…
- A semaphore s is initialised to 0. Three threads run concurrently, and print(X) prints the single letter X atomically. Thread 1: print(A)…
- Two threads share an integer x initialised to 0. Thread 1 executes the loop body x = x + 1 three times; Thread 2 executes it twice. Each…