📝 Multithreading models in operating system (33 MCQs)
Mapping User Threads to Kernel Threads
Multithreading models describe how user-level threads created by an application are associated with kernel-supported threads that the operating system schedules. This mapping determines how many application threads can execute simultaneously, how blocking operations affect other threads, and where scheduling responsibilities are performed. The principal textbook models are many-to-one, one-to-one, and many-to-many, each offering different concurrency and management trade-offs.
Why Thread Mapping Affects Concurrency and Blocking
Applications require convenient thread creation and management, while the kernel must coordinate processor execution and hardware resources. User-level thread management can be efficient, but it may not provide independent kernel scheduling for every thread. Mapping models address the relationship between these requirements, balancing management overhead against parallel execution and blocking behaviour.
Many-to-One, One-to-One, and Many-to-Many Organisation
Many-to-one maps several user threads to one kernel thread, so only one mapped execution stream can run at a time. One-to-one provides a kernel thread for each user thread. Many-to-many multiplexes multiple user threads over a smaller or equal number of kernel-supported execution entities, allowing flexible mapping and parallelism.
Mapping Twelve User Threads to Available Kernel Threads
Suppose an application creates 12 user threads. A many-to-one model maps them to one kernel thread, preventing simultaneous execution. A one-to-one model requires 12 kernel threads. A many-to-many model might multiplex the 12 user threads over four kernel threads, allowing up to four threads to execute simultaneously on four available cores.
Parallelism, Blocking Behaviour, and Resource Overhead
One-to-one provides straightforward kernel scheduling and multicore utilisation but may create considerable kernel-thread overhead. Many-to-one keeps kernel management smaller but restricts parallelism and can suffer from blocking limitations. Many-to-many offers flexible multiplexing but requires more sophisticated runtime and kernel coordination. Actual operating systems may use implementation-specific designs rather than textbook mappings.
Misconceptions About User and Kernel Thread Counts
'Many-to-one supports simultaneous execution on several cores' is incorrect because its threads share one kernel execution entity. 'One-to-one always provides the best performance' is incorrect because additional kernel threads consume resources. 'Many-to-many requires fewer user threads than kernel threads' is incorrect because it normally multiplexes multiple user threads over kernel execution entities.
Exam Focus: Thread Mapping Diagrams and Model Comparison
Draw the three mapping models and identify the number of user and kernel threads in each. Compare blocking behaviour, kernel overhead, and multicore parallelism. Given 20 user threads and four kernel threads, determine which model can multiplex the workload. Questions may also examine why many-to-one cannot exploit multiple cores simultaneously.
Key Terms of Multithreading Models
- User thread - Thread managed at application level.
- Kernel thread - Thread managed by the kernel.
- Many-to-one - Many user threads mapped to one kernel thread.
- One-to-one - Each user thread has a kernel thread.
- Many-to-many - Multiple user threads multiplexed over kernel threads.
- Multiplexing - Sharing execution entities among threads.
📝 All Multithreading models in operating system MCQs
Q1. What is the fundamental relationship described by a multithreading model?
📖 Explanation: A user thread is managed by an application-level thread library or runtime, whereas a kernel thread is represented and scheduled by the operating system. Mapping models describe how these two execution entities correspond.
Q2. A runtime creates several user threads but maps all of them to one kernel thread. Which model is being used?
📖 Explanation: Many-to-one associates multiple user threads with a single kernel thread. The runtime can switch among user threads, but the kernel sees only one schedulable execution path for that process at a time.
Q3. An application creates nine user threads, and the operating system maintains nine corresponding kernel threads. Which mapping does this represent?
📖 Explanation: In one-to-one mapping, each user thread has a corresponding kernel thread. This gives the operating system an independently schedulable entity for each user thread, subject to system resource limits and policies.
Q4. A runtime multiplexes 12 user threads over three kernel threads. Assuming enough processor cores and runnable work, what is the maximum number of these user threads that can execute simultaneously?
📖 Explanation: Twelve user threads mapped onto three kernel threads provide at most three simultaneous execution paths. The remaining user threads must await scheduling onto an available kernel thread, even if more user tasks exist.
Q5. A runtime allows many user threads to share a kernel-thread pool but permanently associates one selected user thread with a particular kernel thread. Which model supports this arrangement?
📖 Explanation: The two-level model retains many-to-many multiplexing while allowing selected user threads to be bound to particular kernel threads. It therefore combines flexible sharing with dedicated mappings for chosen threads when required.
Q6. A user thread in a many-to-one process makes a blocking system call that blocks the only underlying kernel thread. A student expects the other user threads to continue on that same kernel thread. What is the error?
📖 Explanation: The flawed assumption is that other user threads can use the same blocked kernel thread. In many-to-one, blocking that single kernel thread can stop progress for all user threads mapped to it.
Q7. A many-to-one runtime switches among user threads very frequently. A student concludes that the threads therefore execute in parallel on separate cores. Which correction is accurate?
📖 Explanation: Frequent switching by a user-level runtime can interleave threads and provide concurrency, but it does not create another kernel execution path. One shared kernel thread still cannot run on two cores simultaneously.
Q8. A process uses one-to-one mapping. One user thread blocks while reading a file, and three other user threads have independent CPU work ready. What can the operating system do?
📖 Explanation: In one-to-one mapping, the blocked user thread's kernel thread waits for the disk operation. Other user threads have separate kernel threads, so the scheduler can run them if they are ready and processors are available.
Q9. A server uses one-to-one mapping for thousands of user threads, many of which remain idle. Which cost deserves particular attention?
📖 Explanation: One-to-one mapping creates a kernel thread for every user thread. This supports independent kernel scheduling and multicore execution, but large thread populations can consume more kernel memory and increase management overhead.
Q10. A developer claims that a many-to-many implementation performs all scheduling in user space, so the kernel does not schedule any threads. What is missing from this explanation?
📖 Explanation: The runtime selects user threads for available kernel execution paths, but the operating system still schedules kernel threads on processors. Many-to-many therefore involves coordination between user-level mapping decisions and kernel scheduling.
Q11. An application has 18 runnable user threads mapped onto five kernel threads and runs on eight available cores. Assuming each kernel thread can execute one user thread at a time, what is the maximum simultaneous execution count?
📖 Explanation: The five kernel threads provide only five independent execution paths, even though eight cores and eighteen user threads exist. Therefore, the maximum simultaneous execution count is limited to five under the stated assumptions.
Q12. A many-to-many process has four kernel threads. One user thread blocks on a call using one kernel thread, while other user threads remain runnable. What is the most accurate expectation?
📖 Explanation: A blocking call occupies the kernel thread carrying that user thread, but it need not stop the entire process. Other user threads can progress when remaining kernel execution paths are available and the runtime schedules them.
Q13. A graph plots user-thread count U against kernel-thread count K for a mapping with these points: (1,1) ; (3,1) ; (5,1) ; (8,1) ; (12,1). Which model does the constant kernel-thread count represent?
📖 Explanation: The plotted values keep K equal to one while U increases from one to twelve. Multiple user threads therefore share a single kernel thread, which is the defining mapping pattern of many-to-one.
Q14. A graph contains these user-thread and kernel-thread pairs: (1,1) ; (2,2) ; (3,3) ; (4,4) ; (6,6). Which mapping is represented by the straight-line relationship?
📖 Explanation: Each plotted pair has equal user-thread and kernel-thread counts, so the relationship follows K = U. This is the numerical pattern of one-to-one mapping, where every user thread has its own kernel thread.
Q15. A many-to-many runtime limits its kernel-thread pool to four. Its graph gives these points: (1,1) ; (2,2) ; (4,4) ; (7,4) ; (10,4). How many kernel threads are associated with ten user threads?
📖 Explanation: The plotted relationship increases until the pool reaches four kernel threads, then remains constant. At U = 10, the graph gives K = 4, so ten user threads are multiplexed over four kernel execution paths.
Q16. A two-level runtime has ten user threads and four kernel threads. One user thread is bound to a particular kernel thread, while the remaining user threads share the other kernel threads. What feature distinguishes this model?
📖 Explanation: The two-level model combines a many-to-many arrangement with selective binding. One chosen user thread can retain a particular kernel thread, while other user threads continue to be multiplexed over the remaining kernel execution paths.
Q17. A student sees 20 user threads and four kernel threads and labels the mapping one-to-one because the operating system schedules all four kernel threads. What is the mistake?
📖 Explanation: The incorrect step is equating kernel scheduling with one-to-one mapping. One-to-one requires matching user and kernel thread counts; twenty user threads sharing four kernel threads indicate a many-to-many arrangement in this case.
Q18. Which entity is directly selected by the operating system's kernel scheduler for execution on a processor in these mapping models?
📖 Explanation: The kernel scheduler selects kernel threads as its schedulable execution entities. User-level runtimes may decide which user thread occupies a kernel thread, but processor scheduling is performed by the operating system.
Q19. A service must support a very large number of logical user threads while keeping the kernel-thread count lower. Which trade-off most accurately describes many-to-many mapping compared with one-to-one?
📖 Explanation: Many-to-many can multiplex numerous user threads over fewer kernel threads, reducing kernel resource use. Its cost is greater implementation complexity because user-level mapping and kernel scheduling must coordinate effectively across both levels.
Q20. A program has seven user threads mapped to one kernel thread and runs on a machine with four cores. The developer expects four user threads to execute simultaneously. Which result is possible through this mapping?
📖 Explanation: The four physical cores cannot overcome the single kernel-thread mapping. The runtime may interleave seven user threads, but only one mapped execution path can occupy a processor at any instant through this model.
Q21. A one-to-one process has nine user threads. One thread blocks on input, while the other eight are runnable and independent. If at least eight cores are available, how many can potentially execute simultaneously?
📖 Explanation: The blocked thread cannot execute until its input arrives, but the other eight have independent kernel threads and runnable work. With eight available cores and no dependencies, all eight may execute simultaneously.
Q22. A student says a many-to-many model guarantees that blocking one user thread never affects other user threads. What qualification is missing?
📖 Explanation: The claim is too absolute. A blocked user thread ties up its mapped kernel execution path; other threads can continue only when another path is available and the runtime can assign runnable work to it.
Q23. A process has 12 user threads mapped over three kernel threads. One user thread is blocked, and four processor cores are available. Assuming each kernel thread carries at most one user thread at a time, what is the maximum number that can execute simultaneously?
📖 Explanation: The blocking call occupies one of the three kernel threads, leaving two independent execution paths for other user threads. Four available cores cannot increase that limit, so at most two other runnable threads can execute.
Q24. A workload needs thousands of user threads, several kernel execution paths for multicore work, and a dedicated kernel thread for one latency-sensitive user thread. Which model best fits all three requirements?
📖 Explanation: Two-level mapping supports many user threads over a kernel-thread pool while allowing selected threads to be bound. This meets the stated combination of many logical threads, parallel execution paths, and dedicated treatment for one selected thread.
Q25. A two-level runtime has 14 user threads mapped to five kernel threads. One user thread is bound to one kernel thread, and the rest share the remaining pool. If three cores are available and enough user threads are runnable, what is the maximum simultaneous execution count?
📖 Explanation: Five kernel threads offer up to five execution paths, but only three processor cores are available. The maximum is therefore the smaller value, three, assuming sufficient runnable work and no other restrictions.
Q26. A server creates thousands of user threads using one-to-one mapping. A student argues that this has no additional kernel cost because user threads are lightweight. What is the flaw?
📖 Explanation: The student overlooks the one-to-one correspondence: each user thread requires a kernel thread. Large populations therefore increase kernel-managed thread state and scheduling work, even though each thread shares its process address space.
Q27. A design maps 60 user threads onto six kernel threads. Which model is the most direct description of the relationship?
📖 Explanation: Sixty user threads are multiplexed over six kernel threads, so multiple user threads share kernel execution entities. This is the many-to-many mapping pattern rather than one-to-one or many-to-one in this configuration.
Q28. A student claims a two-level model is simply one-to-one mapping because at least one user thread is bound to a kernel thread. What is the key correction?
📖 Explanation: The defining feature is not merely that binding exists. A two-level model retains multiplexing for other user threads while allowing selected threads to have dedicated kernel-thread associations for specific workloads.
Q29. A many-to-many runtime has eight user threads and four kernel threads. One user thread blocks on a system call using one kernel thread. If the other three kernel threads remain available and runnable user threads can be assigned to them, how many execution paths remain for other work?
📖 Explanation: The blocking call occupies one of the four kernel threads, leaving three other kernel execution paths. Runnable user threads may use those paths, so three execution paths remain for other work under the stated assumptions.
Q30. A diagram shows six user threads mapped onto two kernel threads. One kernel thread is running a user thread while the other is blocked. A third user thread is ready. What must happen before the ready user thread can execute?
📖 Explanation: The ready user thread cannot execute until a kernel execution path is available and assigned to it. In a multiplexed model, user-level readiness alone does not guarantee immediate processor execution.
Q31. An application compares two mappings. Model X has eight user threads sharing one kernel thread; Model Y gives each user thread its own kernel thread. A blocking call occurs in one user thread. Which comparison is correct?
📖 Explanation: In Model X, the single kernel thread is blocked, preventing the other mapped user threads from using it. In Model Y, other user threads have independent kernel threads and may continue if runnable.
Q32. A two-level process has nine user threads and four kernel threads. One user thread is bound to one kernel thread, and the other eight share the remaining three. If four cores are available and all threads are runnable, what is the maximum simultaneous execution count?
📖 Explanation: The mapping provides four kernel execution paths, including the bound thread's path, and four processor cores are available. Thus at most four user threads can execute simultaneously, assuming all paths have runnable work.
Q33. A many-to-many runtime has 20 user threads and six kernel threads. One kernel thread becomes blocked, while five remain available; the machine has four free cores and at least four other user threads are runnable. What is the maximum simultaneous execution count for those other threads?
📖 Explanation: Only five kernel threads remain available, but four free cores impose the tighter limit. With at least four runnable user threads, the maximum simultaneous execution count is four under the stated assumptions.