Thread Management MCQs for NSCT
Thread management is how an operating system creates, schedules and coordinates threads, the units of CPU execution inside a process. The core exam ideas are what threads share and keep private, user versus kernel threads, and the three multithreading models that connect them. It is topic 5 of the Operating Systems area, which carries 5% of the NSCT according to HEC's Areas of Competencies. Operating Systems had the lowest accuracy of any area in 2026, at 33.8%, per the HEC NSCT report and APP.
This page builds on Process Management. We follow Silberschatz's Operating System Concepts.
Threads versus processes
A thread is a basic unit of CPU use. Silberschatz lists what each thread owns and what it shares with the other threads of its process:
| Private to each thread | Shared by all threads of the process |
|---|---|
| Thread ID | Code section |
| Program counter | Data section (global and static variables) |
| Register set | Heap |
| Stack (local variables, return addresses) | Open files and signal handlers |
Because threads share an address space, creating and switching them is cheaper than for processes. Silberschatz names four benefits: responsiveness, resource sharing, economy and scalability. The cost is weaker isolation: one thread's bug can corrupt data that every thread uses.
Concurrency means several tasks make progress; parallelism means several run at the same instant. A single core gives concurrency without parallelism.
Exam angle: a static local variable in C is shared, like a global; an ordinary local variable lives on each thread's own stack.
User vs kernel threads
User threads are managed by a thread library in user space, with no kernel involvement. Creating and switching them is fast, but the kernel does not know they exist. Kernel threads are created, scheduled and managed by the OS itself, so the kernel can block one and run another, or place them on different cores.
| Feature | User threads | Kernel threads |
|---|---|---|
| Managed by | User-level library | Operating system |
| Creation and switch cost | Low (no system call) | Higher (kernel involved) |
| Blocking system call | Can block the whole process (many-to-one) | Blocks only that thread |
| Multicore parallelism | Only through kernel threads | Yes |
The three main thread libraries are POSIX Pthreads, Windows threads and Java threads. Pthreads is a specification, not an implementation, so it can be provided as either a user-level or a kernel-level library.
Exam angle: user threads always need some mapping onto kernel threads to run; that mapping is the multithreading model.
Multithreading models
| Model | Mapping | Blocking call | Parallel on multicore? | Example |
|---|---|---|---|---|
| Many-to-one | Many user threads onto 1 kernel thread | Blocks the whole process | No | Early "green threads" |
| One-to-one | Each user thread onto its own kernel thread | Blocks only that thread | Yes | Linux, Windows |
| Many-to-many | Many user threads onto an equal or smaller number of kernel threads | Others can run on other kernel threads | Yes | Some older UNIX systems |
The two-level model is many-to-many plus the option to bind one user thread to its own kernel thread. Between user and kernel threads, many-to-many systems place a lightweight process (LWP), a virtual processor backed by one kernel thread. Scheduler activations let the kernel tell the library, through an upcall, that a thread is about to block, so it can move work to another LWP.
Example: 6 user threads multiplexed onto 3 kernel threads on an 8-core machine can run at most 3 at once, because only kernel threads reach the cores.
Exam angle: Silberschatz notes many-to-many is the most flexible but hard to implement, which is why modern systems mostly use one-to-one.
Amdahl's law
Amdahl's law gives the best speedup from N cores when a fraction S of the work must run serially: speedup <= 1 / (S + (1 - S) / N). As N grows, the speedup approaches 1/S, so the serial part sets a ceiling.
Threading issues
- fork() and exec(): some UNIX systems offer two versions of fork(): one copies all threads, the other only the caller. If the child calls exec() at once, copying only the caller is enough. POSIX fork() copies only the calling thread.
- Signals: a synchronous signal (for example, division by zero) goes to the thread that caused it.
- Cancellation: asynchronous cancellation stops the target at once; deferred cancellation lets it stop at safe cancellation points.
- Thread-local storage: per-thread data that persists across function calls.
- Implicit threading: thread pools, fork-join, OpenMP and Grand Central Dispatch let a library or compiler manage the threads.
Common traps
- Saying threads share their stacks or registers; only code, data, heap and OS resources are shared.
- Claiming many-to-one gives parallelism on multicore. It never does, because there is one kernel thread.
- Mixing up the drawbacks: whole-process blocking belongs to many-to-one; kernel-thread overhead belongs to one-to-one.
- Multiplying the parallel fraction by the core count instead of applying Amdahl's formula.
- Assuming fork() in a multithreaded program copies every thread; POSIX copies only the caller.
Worked examples
1. Understanding. Why is creating a thread cheaper than creating a process? Answer: a new thread shares its process's code, data, heap and open files, so the OS only has to set up a thread ID, registers and a stack. A new process needs its own address space and resource tables.
2. Application. A program is 60% parallel. What speedups does Amdahl's law predict on 4 and 8 cores? Answer: about 1.82 and about 2.11. 1 / (0.4 + 0.6/4) = 1 / 0.55 = 1.82, and 1 / (0.4 + 0.6/8) = 1 / 0.475 = 2.11. Doubling the cores adds only about 16%, and the ceiling is 1/0.4 = 2.5.
3. Analysis. A process maps 6 user threads onto 2 LWPs on a 4-core machine. One LWP's thread blocks on a disk read. How many of the process's threads can run now? Answer: one. The blocked kernel thread takes its LWP with it, leaving a single LWP for the 5 remaining user threads. The idle cores do not help; with scheduler activations, the kernel could hand the library a fresh LWP through an upcall.
Practise
The quiz below has 100 Thread Management questions, filterable by tier and difficulty.
Practise: 100 questions
FAQs
What is the difference between a process and a thread?
A process is a program in execution with its own address space and resources. A thread is a unit of execution inside a process. Threads of the same process share code, data, heap and open files, but each has its own stack, registers and program counter. Threads are cheaper to create, while processes are better isolated.
Which multithreading model does Linux use?
Linux uses the one-to-one model: each user thread maps to its own kernel thread. Internally Linux calls processes and threads both "tasks" and creates them with clone(), whose flags decide how much the new task shares with its parent. Windows also uses one-to-one.
Why can many-to-one not use multiple cores?
All the user threads run on a single kernel thread, and the operating system schedules only kernel threads onto cores. One kernel thread can run on only one core at a time, so the process never runs two of its threads in parallel, however many cores exist.
Are user threads faster than kernel threads?
Creating and switching user threads is faster, because the library does it without system calls. But under many-to-one, a blocking call stops every thread, and there is no multicore parallelism. Kernel threads cost more per operation but let the OS block, schedule and parallelise each thread independently.
Next step
Continue to Concurrency & Synchronization, revisit CPU Scheduling, return to the Operating Systems MCQ hub, or take a timed NSCT mock test.