This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1The number threads in thread pool depends on
Option B
A thread pool is a collection of pre-created threads used to execute tasks efficiently. The size of the thread pool depends on the number of threads allocated for execution, which is usually decided based on system requirements like CPU cores and workload.
Q: 2In a multithreaded process, which of the following is not shared among threads?
Option A
In a Multithreaded Process, multiple threads run within the same process and share certain resources to efficiently perform tasks concurrently. Threads belonging to the same process share the code section, data section, and files.
However, each thread requires its own Registers and Stack to keep track of its current state, local variables, and execution context.
Q: 3In ___________, one thread immediately terminates the target thread.
Option A
In a multithreaded operating system, one thread may request the termination of another thread. This process is known as thread cancellation.
There are different ways to cancel a thread, depending on when the target thread is actually terminated. The two main types of thread cancellation are:
| Type | Description |
|---|---|
| Asynchronous Cancellation | The target thread is terminated immediately. |
| Deferred (Synchronous) Cancellation | The target thread checks for a cancellation request and terminates at a safe point. |
In Asynchronous Cancellation, one thread immediately stops another thread without waiting for it to reach a safe execution point.
Q: 4Which of the following is TRUE with respect to threads?
Option B
A Thread (lightweight process) is a small execution unit inside a process, and all threads of the same process share the same memory area, including the data space. This is why threads can communicate easily, but they must be synchronized carefully to avoid conflicts.
Q: 5Consider the following statements:
A: Multithreaded applications are characterized by having a small number of highly threaded processes.
B: Multiprocess applications are characterized by the presence of many single-threaded processes.
Which of the following is true about the above statements?
Option D
Multithreading refers to a programming model where multiple threads run within the same process, sharing the same memory space but executing different tasks concurrently.
Multiprocessing, on the other hand, uses multiple processes, each with its own separate memory and resources.
Q: 6Which one of the following is not an advantage of thread pool?
(i) With thread pool, we have control over the state and priority of the thread
(ii) Servicing a request with an existing thread is faster than waiting to create a thread
(iii) Thread pool limits the number of threads that exists at any one point
(iv) Thread creation and destruction overhead is negated
Option A
Thread Pool is a collection of pre-created threads that are reused to perform tasks. Its main goal is to improve performance and manage system resources efficiently.
(i) Control over state and priority of threads
Thread pools focus on reuse and limiting threads, not giving fine control over individual thread states or priorities. Hence, this statement is incorrect.
(ii) Faster servicing using existing threads
Since threads are already created, no time is wasted in creating new threads and result is faster execution.
(iii) Limits number of threads
Thread pools prevent excessive thread creation, avoiding system overload.
(iv) Reduces creation/destruction overhead
Threads are reused, so overhead of repeatedly creating and destroying threads is avoided.
You have reached the end of this topic. Continue learning with the next topic below.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.