Professional Documents
Culture Documents
Session 4.5
Shripad V Deshpande
3
PROCESS CONTROL BLOCK
• A data structure having the information using which the OS
controls the process state
• Stores in protected memory area of the kernel.
• PCB consists of the information about the process state
• The PCB will have following information
• Process ID (PID)
• Process Priority
• Parent Process
• Child Process(s)
• Address to the PCB of next process, which will run next
• Allocated program memory block details in Physical Memory and
Virtual Memory
• Allocated heap memory details
• Allocated process stack addresses for the functions called
during running of the process
4
THREAD
• A thread is a path of execution within a process.
• PCB controls the working of all threads within that process.
• It is the smallest sequence of programmed instructions that
can be managed independently by an operating
system scheduler.
• A thread can be thought of as a light-weight process
• A thread is contained inside a process.
• Multiple threads can exist within the same process and share
resources such as memory, while different processes do not
share these resources.
• One thread does not interfere with other thread.
• Process : a program in execution
• Thread : function in execution
5
SINGLE AND MULTITHREADED PROCESSES
6
THREAD STRUCTURE
Thread ID
Stack Pointer
Each Threads maintains it own
Program Counter
Set of Registers
7
EXAMPLE : DISPLAY PROCESS IN MOBILE PHONE
• Display_Time_Date thread ─ for displaying clock time and
date.
• Display_Battery thread ─ for displaying battery power.
• Display_Signal thread ─ for displaying signal strength
• Display_Profile thread ─ for displaying silent or sound-
active mode
• Display_Message thread ─ for displaying unread message
in the inbox
• Display_Call Status thread ─ for displaying call status;
9
Next Session 4.6 ->
Creating and processing POSIX threads