Os - PPT 4
Os - PPT 4
4
Process means any program is in execution.
A Thread is the unit of execution within a process. A single
process have many threads.
Thread is the segment of a process means a process can
have multiple threads and these multiple threads are
contained within a process.
2
Process means any program Thread means segment of a
is in execution. process.
Process takes more time to Thread takes less time to
terminate. terminate.
It takes more time for It takes less time for
creation. creation.
Thread switching does not
Process switching needs
interaction with operating interact with operating
system.
system.
Process Thread
3
A state of a process is defined in part by the current activity of that
process.
As the process executes it changes its state.
A process passes from number of states during its life, states are as
follows-
1) New state
2) Ready state
3) Running state
4) Wait state
5) Termination state
4
First state is known as new state.
In New state the process is being created.
5
After creation process comes under ready state.
For example: One process is created at the same
time second process is created then both the
process will come under ready state.
6
When CPU is allotted to process in ready state
that process comes in running state.
In running state only one process can stay at a
time. Because CPU can be allotted to single
process at a time.
7
When a process request for input/output than
that process will left the running state, and will
join new state known as wait state.
8
From ready state the process will go to again running state.
The process has finished execution is known as termination
state.
When process is in running state three case will arise:
1st case: If successfully executed then moves to
terminated.
2nd case: when interrupt occurs then it moves to ready
state.
3rd case: when a process requires I/O operation then the
process moves to waiting state.
Process control block (PCB) is a data structure maintained by
OS for every process.
This specifies the process state i.e. new, ready, running,
waiting or terminated.
2. Process ID (PID)
4. CPU Registers
6. Memory-management information:
Disadvantages
User-level threads lack coordination between the thread and
the kernel.
If one thread in a process is blocked, then the total process
blocked.
In this case, thread management is done by the Kernel.
The kernel-level thread is implemented by the operating
system.
The Kernel performs thread creation, scheduling and
management in Kernel space. Kernel threads are generally
slower to create and manage than the user threads.
Advantages
Kernel can simultaneously schedule multiple threads from the
same process.
The kernel-level thread is fully aware of all threads.
Bounded Buffer: the queue has finite length n, thus can keep up to n
messages, hence if the link is full the sender must block until space is
available in the queue.
Waiting Time:
Burst time