ABDULLAH KALEEM (BCSO7173161)
MUSA ABBAS (BCS07173111)
HAMZA KHAN (BCS07173135)
M AHMAD (BCS07173143)
PRESENTATION TOPICS
Thread
Process
Difference between process and thread
Thread state diagram
Advantages of thread
THREADS
Smallest unit of processing that can be performed in operating system (os)
It always exist within a process it mean that a process may contain multiple threads
A thread is contained inside a process and different threads in the same process share some
resources
THREADS
RESOURCES
SINGAL AND MULTI THREAD
SINGAL THREAD
Has single thread of control
It allows the process to perform only one task
MULTI THREAD
Has many threads
Simultaneously execution of different task
PROCESS
There are many threads in a process
DIFFERENCE BETWEEN
PROCESS AND THREAD
A thread is contained inside a
process and different threads in
the same process share some
resources
There are many threads in a
process
THREAD STATE DIAGRAM
New State A thread is in the new state once it
has been created. It doesn't take any CPU
resources until it is actually running.
Runnable State Now the process is taking up
CPU resources because it is ready to run.
However, it is in a runnable state because it
could be waiting for another thread to run and
so it has to wait for its turn.
Blocked State A thread which is not allowed to
continue remains in a blocked state. Let's say
that a thread is waiting for input/output (I/O),
but it never gets those resources, so it will
remain in a blocked state.
Terminated State A thread is terminated if it
finishes a task successfully or abnormally. At
this point, no CPU resources are used
ADVANTAGES OF THREAD
Thread minimize the context switching time.
Use of threads provides concurrency within a process
Efficient communication.
It is more economical to create and context switch threads.
Threads allow utilization of multiprocessor architectures to a greater scale and efficiency.