OS

Interview Questions on OS - Threads

1. What is a Thread?

A thread is a basic unit of CPU utilization. If a process has multiple threads of control, it can perform more than one task at a time.

2. What are the benefits of multithreading?

Responsiveness. Increase responsiveness to the user.
Resource sharing. threads share the memory.

3. What is fork() ?

Fork() is a system call which is used to create a separate, duplicate process.

4. What is exex() ?

exex () is a system call which id used to replace the entire process.

5. What are Multithreading Models?

Many-to-One Model : The many-to-one model (Figure 4.2) maps many user-level threads to one kernel thread
One-to-One Model: The one-to-one model (Figure 4.3) maps each user thread to a kernel thread.
Many-to-Many Model: The many-to-many model (Figure 4.4) multiplexes many user-level threads toa smaller or equal number of kernel threads.

6. What is Thread cancellation?

Thread cancellation is the task of terminating a thread before it has completed.

7. What is the use of the signal?

A signal is used in UNIX systems to notify a process that a particular event has occurred.

8. What is thread pool?

Thread Pool is a container which holds multiple threads.
The general idea behind a thread pool is to create a number of threads at process startup and place them into a pool, where they sit and wait for work. When a server receives a request, it awakens a thread from this pool—if one is available—and passes it the request to service. Once the thread completes its service, it returns to the pool and awaits more work. If the pool contains no available thread, the server waits until one becomes free.

9. What is the use of Thread Pool?

Servicing a request with an existing thread is usually faster than waiting to create a thread.


www.000webhost.com