Consider the statements given below: I) Sleep or wake method is used to avoid busy waiting.
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Consider the statements given below:
I) Sleep or wake method is used to avoid busy waiting.
II) There is no increase in the overhead.
III) There is an increase in the overhead when there is transition from the sleep state to wake up state and vice versa.
IV) Busy waiting uses CPU time for no real computing.
Which of the statement(s) is/are true for the busy waiting?
Show answer & explanation
Statements I, III, and IV are true regarding busy waiting and sleep/wake mechanisms. Statement I is correct: sleep/wake methods are specifically designed to avoid busy waiting. Statement IV is correct: busy waiting wastes CPU cycles polling for a condition rather than performing useful computation. Statement III is correct: transitioning between sleep and wake states incurs overhead (context switching, cache invalidation, etc.). Statement II is false because the sleep/wake mechanism does introduce overhead during state transitions, even though it saves CPU time overall.
Step-by-step Derivation:
Analysis of each statement:
I) Sleep or wake method is used to avoid busy waiting.
→ TRUE. Sleep/wake (or wait/notify) is an alternative to busy waiting that blocks the thread until a condition is met, avoiding CPU waste.
II) There is no increase in the overhead.
→ FALSE. Sleep/wake mechanisms do introduce overhead during state transitions, though less than continuous busy waiting would consume.
III) There is an increase in the overhead when there is transition from sleep state to wake up state and vice versa.
→ TRUE. State transitions involve context switching, memory barriers, and scheduler overhead.
IV) Busy waiting uses CPU time for no real computing.
→ TRUE. Busy waiting continuously polls a condition in a loop, consuming CPU cycles without productive work, also called "spinning" or "active waiting."
Statements I, III, and IV are true. Answer: A