Build fluency in the vocabulary of a lock where a waiting thread busy-waits in a loop instead of sleeping.
0 / 5 completed
1 / 5
At standup, a dev mentions a lock where a thread waiting to acquire it sits in a tight loop repeatedly checking whether the lock is free, instead of being put to sleep and woken up later by the operating system. What is this kind of lock called?
A spinlock is exactly this: a lock where a waiting thread sits in a tight loop repeatedly checking whether the lock has become free, rather than yielding the CPU and being put to sleep by the operating system until it's woken up later. A deadlock is an unrelated concurrency failure about threads permanently blocked on each other, not about how a single thread waits for one lock. This busy-wait behavior is exactly why a spinlock avoids the cost of a context switch, at the price of burning CPU cycles the whole time it waits.
2 / 5
During a design review, the team picks a spinlock specifically for a critical section that's held only for an extremely short time, rather than using a lock that puts a waiting thread to sleep. Which capability does the spinlock provide here?
A spinlock here provides avoiding the cost of a context switch for a wait that's expected to be shorter than that switch would even take, since busy-waiting briefly in a loop can be cheaper overall than paying the operating system's cost of putting a thread to sleep and later waking it back up, when the actual wait is extremely short. A sleeping lock instead pays that context-switch cost on every wait, which is wasteful when the critical section is held only briefly. This short-hold assumption is exactly why a spinlock is reserved for critical sections expected to be held for a very short, bounded amount of time.
3 / 5
In a code review, a dev notices a spinlock protecting a critical section that occasionally performs a slow network call while holding the lock, meaning other threads can end up busy-waiting for a long, unpredictable time. What does this represent?
This is a misuse of a spinlock, since busy-waiting is only cheap when the wait is expected to be short, and a critical section that occasionally makes a slow network call can hold the lock for a long, unpredictable time, during which every other waiting thread burns CPU cycles doing nothing productive. A cache eviction policy is an unrelated concept about discarded cache entries. This is exactly the kind of pattern a reviewer flags, since a sleeping lock would let waiting threads yield the CPU instead of wasting it during an unpredictably long hold.
4 / 5
An incident report shows CPU usage spiked sharply under load because a spinlock was protecting a critical section that occasionally performed a slow network call, leaving many threads busy-waiting and burning CPU cycles for an unpredictably long time. What practice would prevent this?
Replacing the spinlock with a sleeping lock for this critical section lets a waiting thread yield the CPU and be woken up later instead of busy-waiting the whole time, which directly eliminates the wasted CPU cycles that spiked usage in this incident. Continuing to use the spinlock regardless of the network call's unpredictable duration is exactly what let so many threads burn CPU busy-waiting under load. This is the standard fix once a critical section's hold time is no longer reliably short, since that's precisely the assumption a spinlock's cheap busy-wait depends on.
5 / 5
During a PR review, a teammate asks why the team reserves spinlocks for extremely short critical sections instead of using them everywhere a lock is needed, given that a spinlock avoids the overhead of a sleeping lock's context switch. What is the reasoning?
A spinlock's busy-waiting thread burns real CPU cycles for the entire time it waits, so once a critical section's hold time becomes longer or less predictable, that wasted CPU cost can easily outweigh the context-switch savings the spinlock was chosen for in the first place. A sleeping lock instead lets a waiting thread give up the CPU entirely, which costs a context switch but avoids burning cycles unproductively during a longer wait. The tradeoff is exactly why spinlocks are reserved for critical sections with a short, reliably bounded hold time, and sleeping locks are used everywhere a wait might stretch on unpredictably.
What does the "Spinlock Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to spinlock vocabulary through 5 multiple-choice questions, each built from realistic workplace sentences rather than abstract definitions.
Is this vocabulary exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 5 questions. Each one shows a real-world sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question, and a full results screen at the end.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Are these vocabulary exercises connected to other topics?
Yes — browse the full vocabulary exercises hub to find related modules covering adjacent IT topics and roles.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more vocabulary exercises?
Browse the full Vocabulary exercises hub for hundreds of modules covering Agile, DevOps, security, databases, architecture, and more — organised by IT role and skill.