CS FundamentalsVery hardGATE CS (PYQ pattern)
In Lamport's bakery algorithm five processes P0 to P4 hold tickets (number, id): P0 has 4, P1 has 3, P2 has 4, P3 is not competing (0) and P4 has 3. In what order do the competing processes enter the critical section?
- A. P1, P4, P2, P0
- B. P0, P2, P1, P4
- C. P1, P4, P0, P2
- D. P4, P1, P0, P2
Correct answer: C. P1, P4, P0, P2
Processes are ordered by (ticket, process id), so equal tickets are broken by the smaller id: (3,1), (3,4), (4,0), (4,2). A process with ticket 0 is not waiting.
More Operating Systems questions
- A 200 KB heap is managed with a first-fit free list; adjacent free blocks are merged when memory is freed. Operations in order: alloc…
- A fixed-size job runs 6 times faster on 8 cores than on 1 core. Assuming Amdahl's law holds exactly (a serial fraction f, the rest…
- Three philosophers sit at a table with three forks; philosopher i always picks up fork i (left) first and then fork (i+1) mod 3 (right)…
- A data TLB has 64 entries organised as 16 sets of 4 ways (set index = virtual page number mod 16, LRU within a set). A loop touches…
- The enhanced clock algorithm uses (R, M) bits with 3 frames (initially empty, newly loaded pages get R = 1 and M = 1 if loaded by a…
- Page-fault-frequency control with threshold T = 3: on a fault at time t, if more than 3 time units passed since the previous fault, all…