OA. free
Free
Qualcomm Embedded Systems & Hardware Embedded Systems & Hardware Medium

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?

Choose one option.
Show answer & explanation
Answer: A. Only (I), (III) and (IV)

Statement I is true: sleep/wake methods are alternatives to busy waiting that improve CPU efficiency. Statement III is true: context switching between sleep and wake states incurs overhead (thread scheduling, state management). Statement IV is true: busy waiting wastes CPU cycles in loop polling. Statement II is false: sleep/wake mechanisms do introduce overhead, just less than busy waiting. Therefore, statements I, III, and IV are correct.

Step-by-step Derivation:
Analysis of each statement:

Statement I - TRUE: Sleep/wake (conditional variables, semaphores, event signaling) are designed specifically to replace busy waiting. Instead of repeatedly checking a condition, a thread waits and is awakened when the condition becomes true.

Statement II - FALSE: Sleep/wake mechanisms are NOT overhead-free. There is context switching overhead, but it's significantly less than busy waiting because the CPU is released and can perform other work.

Statement III - TRUE: Transitioning between sleep and wake states involves context switching, which includes: saving/restoring CPU registers, updating thread states, managing the scheduler queue. This creates measurable overhead, though it's amortized over longer idle periods.

Statement IV - TRUE: Busy waiting (polling in a loop) continuously consumes CPU cycles checking a condition without performing useful computation. This is wasteful and reduces throughput for other processes.

Conclusion: Statements I, III, and IV are true. Statement II is false because sleep/wake mechanisms do have transition overhead.

Answer: A