Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Thread ManagementEasy
Q1. A thread is:
- A.A type of volatile memory block
- B.A lightweight execution unit in process✓ Correct
- C.A physical hardware component part
- D.A complete standalone process
Explanation
A thread is a lightweight unit of CPU utilization within a process. It has its own thread ID, program counter, register set, and stack but shares code, data, and resources with other threads in the same process.
Report an error in this question
Thread ManagementEasy
Q2. Threads within the same process share all of the following EXCEPT:
- A.Data section
- B.Stack space✓ Correct
- C.Open files
- D.Code section
Explanation
Threads share code, data, and resources (like open files) but each thread has its own stack, program counter, and register set to maintain its individual execution context.
Report an error in this question
Thread ManagementEasy
Q3. What is the main advantage of using threads over processes?
- A.Threads can run on different machines
- B.Threads are inherently more secure overall
- C.Thread creation and switching are faster✓ Correct
- D.Threads use significantly more memory
Explanation
Threads are cheaper to create and context-switch than processes because they share the same address space and resources. Only the stack, registers, and program counter need to be saved/restored.
Report an error in this question
Thread ManagementEasy
Q4. User-level threads are managed by:
- A.The file system layer
- B.A user-level thread library✓ Correct
- C.The hardware platform
- D.The kernel directly
Explanation
User-level threads are managed by a user-level thread library (like POSIX Pthreads) without kernel involvement. The kernel is unaware of user-level threads.
Report an error in this question
Thread ManagementEasy
Q5. Kernel-level threads are managed by:
- A.A web browser
- B.A compiler tool
- C.User applications
- D.The OS kernel✓ Correct
Explanation
Kernel-level threads are managed directly by the operating system kernel. The kernel is responsible for scheduling and managing these threads.
Report an error in this question
Thread ManagementEasy
Q6. Multithreading benefits include all EXCEPT:
- A.Resource sharing across threads
- B.Responsiveness to user input
- C.Economy of creation and switching
- D.Guaranteed elimination of bugs✓ Correct
Explanation
Benefits of multithreading include responsiveness, resource sharing, economy (cheaper than processes), and scalability on multiprocessor systems. It does not guarantee elimination of bugs.
Report an error in this question
Thread ManagementEasy
Q7. POSIX Pthreads is:
- A.A standard API for thread management✓ Correct
- B.A file system for multithreading
- C.A hardware component for threads
- D.An operating system distribution
Explanation
POSIX Pthreads (POSIX threads) is a standardized API (IEEE 1003.1c) for creating and managing threads, commonly available on UNIX/Linux systems.
Report an error in this question
Thread ManagementEasy
Q8. In a single-threaded process, how many threads of control exist?
- A.One thread✓ Correct
- B.Many threads
- C.Two threads
- D.Zero threads
Explanation
A single-threaded process has exactly one thread of control. Traditional (heavyweight) processes are single-threaded, executing one sequence of instructions at a time.
Report an error in this question
Thread ManagementEasy
Q9. Which of the following is a benefit of multithreading in web server applications?
- A.It handles multiple client requests concurrently✓ Correct
- B.It reduces overall system security
- C.It simplifies the server source code logic
- D.It eliminates the need for any networking
Explanation
Multithreaded web servers can handle multiple client requests concurrently by assigning each request to a separate thread, improving responsiveness and throughput.
Report an error in this question
Thread ManagementEasy
Q10. A process can contain:
- A.One or more threads✓ Correct
- B.No threads at all
- C.Only two threads
- D.Only one thread
Explanation
A process can contain one or more threads. Even a traditional single-threaded process has at least one thread of execution (the main thread).
Report an error in this question
Thread ManagementMedium
Q11. What is the many-to-one threading model?
- A.Each user thread maps to one kernel thread
- B.Many kernel threads map to one user thread
- C.Many user-level threads map to one kernel thread✓ Correct
- D.One user thread maps to many kernel threads
Explanation
In the many-to-one model, many user-level threads are mapped to a single kernel thread. The kernel sees only one thread, so if one user thread blocks, all threads in the process block.
Report an error in this question
Thread ManagementMedium
Q12. What is the one-to-one threading model?
- A.One process only ever has one thread
- B.One kernel thread maps to many user threads
- C.One user thread maps to one kernel thread✓ Correct
- D.All threads share one single CPU together
Explanation
In the one-to-one model, each user-level thread maps to one kernel thread. This provides more concurrency but thread creation overhead is higher. Linux and Windows use this model.
Report an error in this question
Thread ManagementMedium
Q13. What is the disadvantage of the many-to-one threading model?
- A.If one thread blocks, all threads in process block✓ Correct
- B.It cannot create more than two threads total
- C.It uses too many kernel resources overall
- D.It is too slow for practical usage scenarios
Explanation
Since all user threads map to a single kernel thread, if one user thread makes a blocking system call, the kernel thread blocks, causing all other user threads in the process to block as well.
Report an error in this question
Thread ManagementMedium
Q14. What is a thread pool?
- A.A memory allocation area used for threads
- B.Pre-created threads that wait for work tasks✓ Correct
- C.A collection of currently unused threads
- D.A debugging tool for analyzing thread bugs
Explanation
A thread pool creates a number of threads at startup that sit idle waiting for work. When a request arrives, a thread from the pool is assigned to service it, avoiding the overhead of creating a new thread each time.
Report an error in this question
Thread ManagementMedium
Q15. What happens to threads when fork() is called in a multithreaded program?
- A.The child process is created with no threads
- B.All threads are always duplicated in the child
- C.Fork cannot be used in multithreaded programs
- D.It depends on the system; some dup all, some one✓ Correct
Explanation
The behavior of fork() in multithreaded programs depends on the system. POSIX provides two versions: one duplicates all threads, another duplicates only the calling thread. Typically only the calling thread is duplicated.
Report an error in this question
Thread ManagementMedium
Q16. What is thread cancellation?
- A.Terminating a thread before completion✓ Correct
- B.Creating a brand new thread from scratch
- C.Moving a thread to a different process
- D.Suspending a thread temporarily in place
Explanation
Thread cancellation is the task of terminating a thread before it has finished. It can be asynchronous (immediate termination) or deferred (thread periodically checks if it should terminate).
Report an error in this question
Thread ManagementMedium
Q17. What is the difference between asynchronous and deferred thread cancellation?
- A.Asynchronous is safer because it checks all resources before acting
- B.Asynchronous terminates immediately; deferred checks at safe points✓ Correct
- C.Deferred cancellation is always much faster than asynchronous type
- D.There is no difference between the two cancellation types
Explanation
Asynchronous cancellation terminates the thread immediately, which can leave shared data in an inconsistent state. Deferred cancellation is safer as the thread periodically checks cancellation points.
Report an error in this question
Thread ManagementMedium
Q18. Thread-Local Storage (TLS) allows:
- A.Threads to communicate with each other via messages
- B.Each thread to have its own copy of certain data✓ Correct
- C.All threads to share the exact same data copies
- D.Data to be stored persistently on disk for threads
Explanation
Thread-Local Storage (TLS) allows each thread to have its own copy of data. Unlike local variables (visible only during a single function invocation), TLS data persists across function calls within that thread.
Report an error in this question
Thread ManagementMedium
Q19. What is implicit threading?
- A.Threads that remain invisible to the programmer
- B.Threads that run implicitly without any OS scheduling
- C.Threads that do not use any system resources at all
- D.Transferring thread management to compilers and runtimes✓ Correct
Explanation
Implicit threading transfers the responsibility of creating and managing threads from application developers to compilers and runtime libraries, using approaches like thread pools, OpenMP, and Grand Central Dispatch.
Report an error in this question
Thread ManagementMedium
Q20. OpenMP is used for:
- A.File compression utilities
- B.Parallel shared-memory programming✓ Correct
- C.Database management systems
- D.Network programming via APIs
Explanation
OpenMP is an API for parallel programming on shared-memory multiprocessor systems. It uses compiler directives (pragmas) to identify parallel regions that can be executed concurrently by multiple threads.
Report an error in this question
Thread ManagementHard
Q21. What is the many-to-many threading model and what advantage does it offer?
- A.It creates many processes for running threads
- B.It is the simplest threading model to implement
- C.It multiplexes user threads onto kernel threads✓ Correct
- D.It maps many threads to many individual CPUs
Explanation
The many-to-many model multiplexes many user threads onto a smaller or equal number of kernel threads. It avoids the blocking issue of many-to-one and the overhead of one-to-one, but is complex to implement.
Report an error in this question
Thread ManagementHard
Q22. What is the two-level threading model?
- A.A model with exactly two priority levels only
- B.A model with exactly two scheduling queues
- C.Many-to-many plus binding user thread to kernel✓ Correct
- D.A model that uses exactly two processor CPUs
Explanation
The two-level model is a variation of the many-to-many model that also allows a user thread to be bound to a specific kernel thread (one-to-one binding), combining the flexibility of both approaches.
Report an error in this question
Thread ManagementHard
Q23. What is a Lightweight Process (LWP) in the context of user and kernel thread mapping?
- A.A process that runs and completes very quickly
- B.A type of user-level thread implementation
- C.An intermediate structure between user and kernel✓ Correct
- D.A process with very low memory usage footprint
Explanation
An LWP is an intermediate data structure that appears as a virtual processor on which user threads can be scheduled. Each LWP is attached to a kernel thread, and user threads are multiplexed onto LWPs.
Report an error in this question
Thread ManagementHard
Q24. How does signal handling work in a multithreaded program?
- A.Signals are ignored in multithreaded programs
- B.Only the main thread ever receives any signal
- C.Signals are always delivered to every thread
- D.Signals go to applicable, all, or designated thread✓ Correct
Explanation
Signal delivery in multithreaded programs can be: to the applicable thread (e.g., division by zero), to every thread (e.g., SIGKILL), to certain threads, or to a designated thread that handles all signals.
Report an error in this question
Thread ManagementHard
Q25. What is the scheduler activation mechanism?
- A.A method to start or initialize the operating system
- B.A timer-based scheduling technique for real-time use
- C.A way to activate the CPU scheduling component
- D.Kernel upcalls maintaining correct kernel thread count✓ Correct
Explanation
Scheduler activations provide upcalls - a communication mechanism from kernel to user thread library. When a thread blocks, the kernel makes an upcall to inform the thread library, which can then schedule another thread.
Report an error in this question
Thread ManagementHard
Q26. What is Grand Central Dispatch (GCD)?
- A.A database system for concurrency
- B.Apple technology managing dispatch queues✓ Correct
- C.A network routing protocol for devices
- D.A Linux kernel module for scheduling
Explanation
GCD is an Apple technology that manages concurrent operations through dispatch queues (serial and concurrent) backed by a system-managed thread pool, abstracting thread management from developers.
Report an error in this question
Thread ManagementHard
Q27. What is the fork-join parallelism pattern?
- A.A pattern for optimizing disk I/O performance
- B.A pattern for managing file system operations
- C.Parent forks child threads, then joins on completion✓ Correct
- D.A pattern for managing network communication tasks
Explanation
Fork-join parallelism divides a task into subtasks (fork), executes them in parallel using multiple threads, and then waits for all subtasks to complete and combines results (join).
Report an error in this question
Thread ManagementHard
Q28. What problem does the clone() system call solve in Linux that fork() doesn't?
- A.It creates child processes much faster than fork
- B.It allows more than 256 concurrent running processes
- C.It prevents zombie processes from accumulating in table
- D.It controls exactly which resources parent and child share✓ Correct
Explanation
Linux clone() provides flags to specify exactly which resources are shared between parent and child (memory, file descriptors, etc.), enabling creation of threads (share everything) or processes (share nothing).
Report an error in this question
Thread ManagementHard
Q29. In the context of Intel Threading Building Blocks (TBB), what is a task?
- A.A fixed-size dedicated thread object
- B.A system call for thread management
- C.A work unit mapped to threads by runtime✓ Correct
- D.A hardware timer for task scheduling
Explanation
In TBB, a task is a lightweight unit of work that the runtime dynamically maps to available threads. This task-based parallelism abstracts thread management, allowing the runtime to optimize thread usage.
Report an error in this question
Thread ManagementHard
Q30. Why have most modern operating systems moved away from the many-to-many threading model to the one-to-one model?
- A.Many-to-many has known security vulnerabilities
- B.Systems now efficiently support many kernel threads✓ Correct
- C.Many-to-many is more expensive to run overall
- D.One-to-one uses significantly less memory overall
Explanation
Modern systems can efficiently support thousands of kernel threads, making the complexity of the many-to-many model (LWPs, scheduler activations) hard to justify. The simpler one-to-one model is sufficient and widely adopted.
Report an error in this question