Thread Lect-9
Thread Lect-9
Kind of Thread
Types of Thread
Benefit of MultiThreading
MultiThreading Model
Why we divide process into threads?
– To acheive parallelism, we divide process into threads
Example:
– In a web browser, multiple tabs can be a different thread
– In MS word use mutiple thread
• Typing
• Formatting
• Speel check
Thread
Kind of Thread
Benefits of MultiThreads
• 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.
• 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.
• 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 are a stack and register for each thread.
User level Kernel Level
1 User level thread are managed by user level Kernel level thread are managed by OS system call
libraries
2 User level thread are faster than Kernel Kernel level thread are slower than User level
level thread
3 Context switching is faster Context switching is slower
4 If one User level thread blocked then the If one Kernel level thread blocked, no effects on
entire process get blocked other threads