GATE CSE 2019 Q33: Race on shared D = 100 with D+20, D−50, D+10: max minus min final value
- Operating System
- 1 mark
- NAT
- No negative marking
Syllabus topic: Inter-process communication, concurrency and synchronization
Question
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100.
| P1 | P2 | P3 |
|---|---|---|
| ⋮ | ⋮ | ⋮ |
| D = D + 20 | D = D − 50 | D = D + 10 |
| ⋮ | ⋮ | ⋮ |
The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three processes have completed execution are X and Y respectively, then the value of Y − X is _____________.
Try it: numerical answer: type the value
Show answer and explanation
Answer: 80 (official GATE 2019 final answer key)
Concept used: Race condition: each update is a read-modify-write, so an interleaving can lose other processes' updates.
First step: For the maximum, let P2 read D first but write before the others write their results; for the minimum, arrange for P2's write to be the last one, overwriting the additions.
Full step-by-step solution
Loading…
Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.
More questions on Inter-process communication, concurrency and synchronization
Every PYQ on this topic →Share this question
Source: official GATE 2019 CS question paper and final answer key, organised by IIT Madras. Question paper · Answer key
More Operating System PYQs
- 2026 Session 1 · Q29False statements about deadlocks
- 2026 Session 1 · Q35Minimum resource instances for deadlock freedom (5 processes, max 2)
- 2026 Session 1 · Q59Disk transfer time for random sectors on tracks 5, 12, 7
- 2026 Session 1 · Q63Number of printf calls with fork, continue and break
- 2026 Session 1 · Q64Average FCFS waiting time for alternating A and C processes
- 2026 Session 2 · Q23CPU scheduling algorithm that cannot be preemptive