Unit 3 Process and Thread Kernel Data Structure
Unit 3 Process and Thread Kernel Data Structure
The process can be split down into so many threads. For example, in a browser, many tabs can be viewed as threads. MS Word uses
many threads - formatting text from one thread, processing input from another thread, etc.
Need of Thread:
o It takes far less time to create a new thread in an existing process than to create a new process.
o Threads can share the common data, they do not need to use Inter- Process communication.
o Context switching is faster when working with threads.
o It takes less time to terminate a thread than a process.
Types of Threads
In the operating system, there are two types of threads. 1. Kernel level thread. 2. User-level thread.
User-level thread
The operating system does not recognize the user-level thread. User threads can be easily implemented and it is implemented by the
user. If a user performs a user-level thread blocking operation, the whole process is blocked. The kernel level thread does not know
nothing about the user level thread. The kernel-level thread manages user-level threads as if they are single-threaded
processes?examples: Java thread, POSIX threads, etc.
Advantages of User-level threads
1. The user threads can be easily implemented than the kernel thread.
2. User-level threads can be applied to such types of operating systems that do not support threads at the kernel-level.
3. It is faster and efficient.
4. Context switch time is shorter than the kernel-level threads.
5. It does not require modifications of the operating system.
6. User-level threads representation is very simple. The register, PC, stack, and mini thread control blocks are stored in the
address space of the user-level process.
7. It is simple to create, switch, and synchronize threads without the intervention of the process.
Disadvantages of User-level threads
1. User-level threads lack coordination between the thread and the kernel.
2. If a thread causes a page fault, the entire process is blocked.
Enhanced throughput of the system: When the process is split into many threads, and each thread is treated as a job, the
number of jobs done in the unit time increases. That is why the throughput of the system also increases.
Effective Utilization of Multiprocessor system: When you have more than one thread in one process, you can schedule more
than one thread in more than one processor.
Faster context switch: The context switching period between threads is less than the process context switching. The process
context switch means more overhead for the CPU.
Responsiveness: When the process is split into several threads, and when a thread completes its execution, that process can be
responded to as soon as possible.
Communication: Multiple-thread communication is simple because the threads share the same address space, while in process,
we adopt just a few exclusive communication strategies for communication between two processes.
Resource sharing: Resources can be shared between all threads within a process, such as code, data, and files. Note: The stack
and register cannot be shared between threads. There is a stack and register for each thread.