Professional Documents
Culture Documents
Multitasking
Threads
Types of threads
Kernel threads
User level threads
Multithreading model
One to One Model
Many to One Model
Many to Many Model
Solaris 2 threads
Windows 2000 threads
Linux threads
Java threads
Responsiveness
It allows to run a program even if some part of it is in block state
Resource sharing
Different threads of a program behaving like multiple processes
are sharing same address space
Economy
Overheads of context switching of TCB are much lesser than of
PCB
Scalability
Utilization of multiprocessor architecture
Threads are very useful in multiprocessor architecture
Due to threading a single program can run on different
processors at same time
There are two types of threads i.e. kernel threads and user
level threads
Kernel threads
Theses are supported directly by operating system
The kernel perform thread creation, scheduling and management
Example kernel threads supporting OS are;
Windows 95/98/2000/XP
Solaris, Tru64, Unix
Linux, Mach and OS/2
User threads
These are supported above the kernel, via a set of library calls at
the user level
Library provides support for thread creation, scheduling and
management with no support from kernel
Example user-threads
POSIX P thread
Mach C thread
Solaris UI thread
Hybrid approach implements both user-level and kernel
supported threads
Solaris 2 is based on Unix with support for threads at the kernel and user
levels
It introduce an intermediate level between kernel and user level threads
which is called LWP(light weight process)
Resource needs of threads;
Kernel thread
Small data structure and stack
Thread switching does not require changing memory access information
It is relatively fast
LWP
PCB with register data
Accounting and memory information
Switching between LWPs is relatively slow
User level thread
Only need stack and program counter
No kernel involvement means fast switching
Kernel only sees the LWPs that support user level threads