CS FundamentalsModerateGATE CS · Amazon/Microsoft SDE MCQ
Three users run the same 60 KB editor (pure, reentrant code) and each has 20 KB of private data. With paging that lets the code pages be shared, how much memory do the three need, versus without sharing?
- A. 120 KB versus 240 KB
- B. 140 KB versus 240 KB
- C. 80 KB versus 240 KB
- D. 120 KB versus 180 KB
Correct answer: A. 120 KB versus 240 KB
Shared: one copy of the code plus three data areas, 60 + 3 × 20 = 120 KB. Without sharing each user has 80 KB: 240 KB. Sharing needs the code to be read-only, i.e. reentrant.
More Operating Systems questions
- In a monitor with Mesa (signal-and-continue) semantics, why must a consumer write while (count == 0) wait(notEmpty); instead of if (count…
- In the first readers-writers solution (readers share a count; the first reader locks out writers and the last reader lets them in), what…
- Five philosophers each pick up their left fork and then their right fork. Which change removes the possibility of deadlock without adding…
- Two processes use while (lock) ; lock = 1; / CS / lock = 0; with a plain shared variable (no atomic instruction). Which requirement of the…
- In Peterson's algorithm for P0 and P1, the entry code for Pi is flag[i] = true; turn = j; while (flag[j] && turn == j);. What goes wrong…
- A counting semaphore is implemented WITHOUT busy waiting, and its value is −3 at some moment. What does this tell you?