Q: 1 The number threads in thread pool depends on
No. of processes
No. of threads
No. of processes and threads communicate each other
No. of the exited threads
[ 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: 2 In a multithreaded process, which of the following is not shared among threads?
Registers
Data
Code
Files
[ 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: 3 Which of the following is TRUE with respect to threads?
It shares the instruction space of other threads in the process.
It shares the data space of other threads in the process.
It shares the instruction space of kernel.
It shares the data space of kernel.
[ 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: 4 Consider 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?
Only A is correct.
Only B is correct.
Neither A nor B is correct.
Both A and B are correct.
[ 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: 5 Which 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
Only (i)
Only (i) and (ii)
Only (ii) and (iv)
Only (i) and (iv)
[ 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.
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.