Académique Documents
Professionnel Documents
Culture Documents
Synchronization of Processes,
Threads and Tasks:
Lesson-2: Thread
2008
Thread Concepts
2008
Thread
A thread consists of executable
program (codes), state of which is
controlled by OS,
The state information thread-status
(running, blocked, or finished), threadstructureits data, objects and a
subset of the process resources, and
thread-stack
2008
Thread lightweight
2008
Process heavyweight
Process
May have process structure with the
virtual memory map, file descriptors,
userID, etc.
Can have multiple threads, which share
the process structure
2008
Thread
A process or sub-process within a process
that has its own program counter, its own
stack pointer and stack, its own priorityparameter for its scheduling by a threadscheduler
Its variables that load into the processor
registers on context switching.
Has own signal mask at the kernel.
2008
2008
Threads Stack
2008
2008
10
2008
11
Multiprocessing OS
2008
12
2008
13
14
2008
15
2008
16
2008
17
Thread parameters
Each thread has independent
parameters ID, priority, program
counter, stack pointer, CPU registers
and its present status.
Thread states starting, running,
blocked (sleep) and finished
2008
18
Threads stack
When a function in a thread in OS is
called, the calling function state is
placed on the stack top.
When there is return the calling
function takes the state information
from the stack top
2008
19
Thread Stack
A data structure having the information
using which the OS controls the thread
state.
Stores in protected memory area of the
kernel.
Consists of the information about the
thread state
2008
20
2008
21
2008
22
2008
23
2008
24
Summary
2008
25
We learnt
A thread is a process or sub-process
within a process that has its own
program counter, its own stack pointer
and stack, its own priority-parameter
for its scheduling by a threadscheduler.
2008
26
We learnt
Thread is a concept in Java and Unix
Thread is a lightweight sub-process or
2008
27
2008
28