Threads
•
A thread is some times called as a light weight
processes, is a basic unit of CPU utilization.
Thread is made up of:
ü
Thread_id
ü
Program counter
ü
Register set
ü
Stack
Thread share :
ü
Code section
ü
Data section
ü
Other OS resources
ü
A traditional process has a single thread of
control.
ü
The idea behind threading is more finer control
on CPU utilization.
ü
Eg. Web browser might have one thread for
displaying pages, one thread for displaying text, another thread for receiving
data from the network.
ü
A word processor program can have one thread for
displaying graphics, one threads for reading e-strokes, another thread for
checking spelling & grammar.
ü
A single application maybe required to perform
several similar task.
•
Benefits
of threading:
ü
Responsivness: Multi-threading
& interactive
application
may allow a program to continue running even if some parts of it are block or
is performing some lengthy operation.
ü
Resource sharing-By default
threads share memory and the resources of the process to which-they belong.
ü
Economy: Allocating memory
resources for process creation is costly. Alternatively,because thread share
resources of the process to which they belong, it is more economical to create
and context switch threads.
ü
Utilization of multi-process and
architectures:
The benefits of multi-threading can be
greatly increased in a multi-process architecture,where each thread can execute
in parallel an a different processor.
•
User threads: User level threads are generally
fast to create & manage .But at the same time they have their drawbacks
also.
•
Kernel threads: They are directly supported by
the OS.
•
Kernel Performs:
ü
Thread creation
ü
Scheduling
ü
Management
•
Its all done by operating systems.
Multi-Threading Models:
1. Many-to-One:

|

2. One-to-one:

|

3.Many-to-many:

No comments:
Post a Comment