Process Vs Thread
Er. Anshu Singh
Assistant Professor
Computer Science & Engineering Department
University of Lucknow
Lucknow
Branch: BCA
Semester: 3
Subject: Computer Architecture
Disclaimer: The e-content is exclusively meant for academic purposes and for
enhancing teaching and learning. Any other use for economic/commercial
purpose is strictly prohibited. The users of the content shall not distribute,
disseminate or share it with anyone else and its use is restricted to advancement
of individual knowledge. The information provided in this e-content is
developed from authentic references, to the best of my knowledge.
Thread: Thread is a single sequence stream within a process. Threads have same properties
as of the process so they are called as light weight processes. Threads are executed one after
another but gives the illusion as if they are executing in parallel. Each thread has different
states. Each thread has a program counter, a register set and a stack space.
Threads are not independent of each other as they share the code, data, OS resources etc.
files code resources
Stack, registers Stack, registers Stack, registers Stack, registers
Multiple thread in a process
Comparison: process vs thread
basis Process Thread
Definition Program under execution A thread is a lightweight
process that can be
managed independently by
a scheduler.
Data and Code sharing Processes have independent A thread shares the data
data and code segments segment, code segment,
files etc. with its peer
threads.
Resource Consumption Processes require more Threads generally need less
resources than threads. resources than processes.
Blocked If a process gets blocked, If a user level thread gets
remaining processes can blocked, all of its peer
continue execution. threads also get blocked.
Communication Communication between Communication between
processes requires more threads requires less time
time than between threads. than between processes
Memory Sharing Processes are totally A thread may share some
independent and don’t memory with its peer
share memory. threads
Context switching time Processes require more Threads require less time
time for context switching for context switching as
as they are heavier. they are lighter than
processes.
Time for termination Processes require more
time for termination. Threads require less time
for termination.
Dependency Individual processes are Threads are parts of a
independent of each other. process and so are
dependent.
References:
1. John P Hayes “Computer Architecture and organization” McGraw Hill
2. Dezso Sima,Terence Fountain and Peter Kacsuk “ Advanced Computer
Architecture” Pearson Education
3. Kai Hwang “ Advanced Computer Architecture” TMH
4. Linda Null, Julia Lobur- The Essentials of Computer Organization and
Architecture, 2014, 4th Edition.