On a single-core system, two threads can make progress during overlapping periods through interleaved execution, even though they are not executing simultaneously. Is this concurrency?
3 Threads and Multithreading Online Quiz Questions
Use this free practice quiz with 20 questions to review 3 Threads and Multithreading, test your knowledge, and prepare for your next test or exam.
A program uses the one-to-one threading model. If one of its threads blocks, can the operating system still schedule another thread from that program?
- A
True
- B
False
An application must isolate components so that a faulty memory write by one component is less likely to affect another. Which design best fits that goal?
- A
Use several threads in one process because their separate stacks prevent them from affecting one another's shared memory.
- B
Use separate processes because their memory is generally better isolated from one another.
- C
Use several threads in one process because each thread receives its own address space.
- D
Use separate processes because they communicate through shared variables by default.
A single-core system alternates between two tasks, allowing each to make progress during overlapping periods, but never executing both at the same instant. Which concept does this describe?
- A
Parallelism, because any overlap in task progress means the tasks execute simultaneously.
- B
Concurrency, because tasks can make progress in overlapping periods without executing simultaneously.
- C
Neither, because tasks on a single core cannot make progress during overlapping periods.
- D
Both concurrency and parallelism, because the operating system interleaves tasks.
Two threads belong to the same process. Which description correctly distinguishes their memory and execution state?
- A
The threads have separate address spaces but share their stacks.
- B
The threads share their registers and program counters but have separate global data.
- C
The threads share the process's address space but have distinct stacks.
- D
The threads share all execution state because they belong to one process.
A runtime maps multiple user threads to a single kernel thread. What is the name of this threading model?
Which per-thread execution-state component is a memory stack?
In a many-to-many model, user threads are multiplexed over a set of , allowing a program to have more than kernel threads.
Two threads update the same shared value without coordination, and overlapping operations can produce an incorrect result. This problem is called a .
Select all statements that describe memory separation provided by separate processes rather than threads within one process.
- A
Separate processes typically have separate address spaces.
- B
Threads in one process typically have separate address spaces.
- C
A process's memory is generally protected from other processes.
- D
Separate processes communicate through shared variables by default.
Select all limitations of the many-to-one model that follow from mapping many user threads to one kernel thread.
- A
A blocking system call may prevent the other user threads from running.
- B
The process can run its user threads in parallel on multiple cores.
- C
The process cannot run its threads in parallel on multiple cores.
- D
Creating each user thread necessarily creates a separate kernel thread.
A runtime needs to support more user threads than kernel threads, while still allowing the operating system to schedule multiple kernel threads for potential parallel execution. Which threading model fits, and what trade-off does it involve?
A program creates more threads but has not changed its workload or coordination. Is it guaranteed to run faster?
- A
True
- B
False
A word processor continues to accept keystrokes while another thread saves a document. What benefit of multithreading does this illustrate?
A program starts two threads in one process. Which description best explains how their memory and execution state are organized?
- A
The threads have separate address spaces and share no process resources.
- B
The threads share the process address space but have distinct stacks.
- C
The threads share one stack but have separate global data.
- D
The threads share only their program counters.
What term describes tasks making progress during overlapping periods, including when a single core interleaves their execution?
A runtime maps many user threads to one kernel thread. When one user thread makes a blocking system call, the others cannot run until that kernel thread is available again. Which model does this illustrate?
- A
One-to-one, because each user thread has its own kernel thread.
- B
Many-to-many, because user threads are distributed across several kernel threads.
- C
Many-to-one, because the sole kernel thread may be blocked by the call.
- D
Two-level, because every user thread is bound to a separate kernel thread.
A design requires the operating system to schedule user threads independently, while accepting higher system-resource costs when many threads are created. Which mapping best fits?
- A
Each user thread maps to a kernel thread, enabling independent scheduling at a greater resource cost.
- B
Many user threads map to one kernel thread, reducing resource use while enabling parallel execution.
- C
Many user threads are multiplexed over kernel threads, with no additional implementation complexity.
- D
Each user thread is bound to all available kernel threads.
A runtime needs to support more user threads than kernel threads while still allowing the operating system to schedule multiple kernel threads. Which model matches this design?
- A
One-to-one, because the number of user threads must equal the number of kernel threads.
- B
Many-to-many, because many user threads can be multiplexed over a set of kernel threads.
- C
Many-to-one, because all user threads share one kernel thread.
- D
Two-level, because no user thread can be bound to a kernel thread.
Two threads update the same shared counter without synchronization. Depending on how their operations overlap, one update may be lost. What problem does this describe?
- A
A deadlock that occurs whenever two threads share memory.
- B
A delay that happens when a thread waits for input or file access.
- C
A process isolation failure caused by separate address spaces.
- D
A race condition caused by uncoordinated overlapping updates to shared data.