All mock tests are FREE till 31 December — register to save your progress

Which of the following statements are CORRECT?
(A) A process always checks the state of the currently executing process to enter its critical section.
(B) Spin locks use busy waiting.
(C) Periodically testing a variable until some value appears is known as busy waiting.
(D) A critical region/section is the part of a program where shared memory (a shared resource) is accessed.
(E) A printer daemon continuously checks to see if there are any files to be printed.

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. (B) and (D) only

Explanation

A spin lock makes a waiting process sit in a tight loop re-testing a lock variable, so (B) is true by definition. A critical section is the part of a process's code that accesses a shared resource, so (D) is true. (A) is wrong because a process entering a critical section checks a shared lock/semaphore variable, not the 'state' of whichever process happens to be running. (C) is wrong because true busy-waiting means continuously (not periodically) re-testing the variable in a spin loop; periodic checking at intervals describes polling, a different, less CPU-wasteful technique. (E) is wrong because a print spooler is driven by its job queue and interrupts, not by continuous polling, which is the whole point of spooling.

More Computer System Architecture questions