SlideShare a Scribd company logo
Process Management
External View of the OS
Hardware
fork()
CreateProcess()
CreateThread()
close()
CloseHandle()
sleep()
semctl()
signal()
SetWaitableTimer()
wait()
WaitForSingleObject()
C
Program
OS
Process Mgr
Memory Mgr
Device Mgr
File Mgr
Process Management Responsibilities
• Define & implement the essential characteristics of a
process and thread
– Algorithms to define the behavior
– Data structures to preserve the state of the execution
• Define what “things” threads in the process can reference
– the address space (most of the “things” are memory
locations)
• Manage the resources used by the processes/threads
• Tools to create/destroy/manipulate processes & threads
• Tools to time-multiplex the CPU – Scheduling the
(Chapter 7)
• Tools to allow threads to synchronization the operation
with one another (Chapters 8-9)
• Mechanisms to handle deadlock (Chapter 10)
Initializing the Machine
• Power up  fetch-execute cycle begins
• Initial (or hardware) process begins to run
• Executes ROM diagnostic program
• Then bootstrap loads the OS
• OS initialization
– Setup & initialize all system data structures (this
creates process & resource abstractions)
– Initialize all devices
– Start daemons – including idle process
– Branches to the scheduler
Kernel Process j
Process i
ISRs
Idle Process
Hardware Process Starts
Program
Hardware
process
Switch to
another
program
BIOS
Process Abstraction Layers
Control
Unit
Pi
Address
Space
Pj
Address
Space
Pk
Address
Space
Hardware process
(OS) coroutines across
pi, pj, and pk under OS
control
Pi
Control
Unit
Pj
Control
Unit
Pk
Control
Unit
pi, pj, and pk each
have their own
virtual machine
OS interface
Pi
Virt Term
Pj
Virt Term
Pk
Virt Term
pi, pj, and pk each
have their own
virtual terminal
Window Mgr interface
OS
Address
Space
Process Mgr
Process Manager Overview
Program Process
Abstract Computing Environment
File
Manager
Memory
Manager
Device
Manager
Protection
Deadlock
Synchronization
Process
Description
CPU Other H/W
Scheduler
Resource
Manager
Resource
Manager
Resource
Manager
Memory
Devices
Process Mgr
System Call Interface
Unix Organization
File
Manager
Memory
Manager
Device
Manager
Protection
Deadlock
Synchronization
Process
Description
CPU Other H/W
Scheduler
Resource
Manager
Resource
Manager
Resource
Manager
Memory
Devices
Libraries
Process
Process
Process
Monolithic Kernel
NT Organization
Processor(s) Main Memory Devices
Libraries
Process
Process
Process
Subsystem
User
Supervisor
Subsystem Subsystem
Hardware Abstraction Layer
NT Kernel
NT Executive
I/O Subsystem
T
T
T
T
T
T T T
T
Process Descriptor
• OS creates/manages process abstraction
• Descriptor is data structure for each process
– Register values
– Logical state
– Type & location of resources it holds
– List of resources it needs
– Security keys
– etc. (see Table 6.1 and the source code of your
favorite OS)
Creating a Process in UNIX
pid = fork();
UNIX kernel
…
Process Table
Process Descriptor
Creating a Process in NT
CreateProcess(…);
Win32 Subsystem
ntCreateProcess(…);
…
ntCreateThread(…);
NT Executive
NT Kernel
…
Handle Table
Process Descriptor
Handles
Application
Kernel
Object
Executive Object
User Space
Supervisor Space
NT Executive
NT Kernel
Handle
NT Process Descriptor
KPROCESS
(PCB)
EPROCESS
User Space
Supervisor Space
ETHREAD
KTHREAD
NTKernel
NTExecutive
NT Process Descriptor
 Kernel process object including:
 Pointer to the page directory
 Kernel & user time
 Process base priority
 Process state
 List of the Kernel thread descriptors that are
using this process
NT Process Descriptor (cont)
 Parent identification
 Exit status
 Creation and termination times.
 Memory status
 Security information
 executable image
 Process priority class used by the thread
scheduler.
 A list of handles used by this process
 A pointer to Win32-specific information
Resource Model
R = {Rj | 0  j < m} = resource types
C = {cj  0 |  RjR (0  j < m)} = units of Rj available
Reusable resource: After a unit of the resource has been
allocated, it must ultimately be released back to the
system. E.g., CPU, primary memory, disk space, … The
maximum value for cj is the number of units of that
resource
Consumable resource: There is no need to release a
resource after it has been acquired. E.g., a message,
input data, … Notice that cj is unbounded.
Resource: Anything that a process can request, then be
blocked because that thing is not available.
Using the Model
• There is a resource manager, Mgr(Rj) for every Rj
Mgr(Rj)
pi can only request ni  cj units of reusable Rj
pi can request unbounded # of units of consumable Rj
• Process pi can request units of Rj if it is currently running
Process
request
•Mgr(Rj) can allocate units of Rj to pi
allocate
release
•pi can release units of Rj that it holds (reusable) or
produces (consumable)
Resource Manager Design
Mgr(Rj)
Process
Resource Pool
release
request
allocate
allocate
allocate
release
release
Address Space
Process
Address
Space
Primary
Memory
Mailboxes
System services
Other objects
Files
Defining the Address Space
• Some parts are built into the environment
– Files
– System services
• Some parts are imported at runtime
– Mailboxes
– Network connections
• Memory addresses are created at compile
(and run) time
The Compile Time Component
Source
Modules
Translator Relocatable
Modules
Link Editor Absolute
Program
Loader Executable
Program
Primary Memory
Processes &Threads
Address
Space
Map
Stack
State
Program
Static
data
Resources
Stack
State
Map
Process State (Version 1)
Ready
Blocked
Running
Start
Schedule
Request
Done
Request
Allocate
Process State (UNIX)
Runnable
Uninterruptible
Sleep
Running
Start
Schedule
Request
Done
I/O Request
Allocate
zombie
Wait by
parent
Sleeping
Traced or Stopped
Request
I/O Complete Resume
Process Hierarchies
• Parent-child relationship may be significant:
parent controls children’s execution
Ready-Active
Blocked-Active
Running
Start
Schedule
Request
Done
Request
Allocate
Ready-Suspended
Blocked-Suspended
Suspend
Yield
Allocate
Suspend
Suspend
Activate
Activate

More Related Content

PPT
Os4 2
PPTX
Operating Systems Process Management.pptx
PDF
Process management
PDF
CS9222 Advanced Operating System
PPTX
operating system module 2 presentation notes
PPT
Chapter03
PDF
Unit 1.1.pdfOperating_SystemOperating_System
PPT
Operating System 3
Os4 2
Operating Systems Process Management.pptx
Process management
CS9222 Advanced Operating System
operating system module 2 presentation notes
Chapter03
Unit 1.1.pdfOperating_SystemOperating_System
Operating System 3

Similar to C06.ppt process management ajkdjsafjcsifjdfv (20)

PPTX
Os unit 3 , process management
PPTX
operatinndnd jdj jjrg-system-1(1) (1).pptx
PPTX
prez4_operacni_systemy principles and fundamentals
PDF
Process Management.pdf
PPTX
Operating Systems
PPTX
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
PPT
PPT
Chapter 02
PPT
Chapter 02
PPTX
2Chapter Two- Process Management(2) (1).pptx
PDF
Linux scheduler
PPT
Chap3.ppt
PPT
23565104 process-management(2)
PDF
OS-Process.pdf
PDF
Operating System-2_Process Managementby_Adi.pdf
PDF
Operating System-Concepts of Process
PPTX
Operating system 18 process creation and termination
PPT
Lecture5
PDF
process.pdfzljwiyrouyaeutoaetodtusiokklhh
PPT
Os unit 3 , process management
operatinndnd jdj jjrg-system-1(1) (1).pptx
prez4_operacni_systemy principles and fundamentals
Process Management.pdf
Operating Systems
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
Chapter 02
Chapter 02
2Chapter Two- Process Management(2) (1).pptx
Linux scheduler
Chap3.ppt
23565104 process-management(2)
OS-Process.pdf
Operating System-2_Process Managementby_Adi.pdf
Operating System-Concepts of Process
Operating system 18 process creation and termination
Lecture5
process.pdfzljwiyrouyaeutoaetodtusiokklhh
Ad

More from Arriene Chris Diongson (20)

PPTX
chap-13-Rizal-in-America and United States.pptx
PPTX
chap-11-and-12-Rizal-in-Hongkong-Macao-and-Japan.pptx
PPT
chap-2-childhood-days.ppt DADFWQDWDWDWDWDW
PPTX
physiological-effects-of-drugs.pptx jeisiis
PPTX
PIKO AND JOLEN.pptx traditional larong pinoy
PPTX
GRANT-IN-AID.pptx fefewfewfewfscefderdwd
PPTX
Week-4.pptxmasckscscsksleewldqdmqwcmcmem
PPTX
con't.pptx skfsjdkfsjfsjofoweowowofmvmvv
PPTX
japaneseperiodinthephilippines-201201063329.pptx
PPT
WWII causes final.ppt world ward 2 dsdsfkfah
PPTX
projectinaralingpanlipunan-131002073548-phpapp02.pptx
PPTX
LESSON 7- Responsibility, Personal, Social and Moral Education (1).pptx
PPTX
controlling-movement.pptx physical education
PPTX
440252806-2-Problems-and-Chalengges-of-PE-and-Sports-K-12.pptx
PDF
controlling-movement.pdf VsdvsCsascasacasc
PDF
GEC-1-Midterm-Lecture3-The-Reform-and-Propaganda-Movement.pdf
PDF
Physical-Fitness-Skill-Related-Fitness.pdf
PDF
Fostering Responsibility, Morality, and Citizenship in.pptx.pdf
PPTX
Lesson 2.pptx Pre - Spanish Period and Propaganda Movement
PPTX
BPE-211.pptx Motor Learning and Motor COntrol
chap-13-Rizal-in-America and United States.pptx
chap-11-and-12-Rizal-in-Hongkong-Macao-and-Japan.pptx
chap-2-childhood-days.ppt DADFWQDWDWDWDWDW
physiological-effects-of-drugs.pptx jeisiis
PIKO AND JOLEN.pptx traditional larong pinoy
GRANT-IN-AID.pptx fefewfewfewfscefderdwd
Week-4.pptxmasckscscsksleewldqdmqwcmcmem
con't.pptx skfsjdkfsjfsjofoweowowofmvmvv
japaneseperiodinthephilippines-201201063329.pptx
WWII causes final.ppt world ward 2 dsdsfkfah
projectinaralingpanlipunan-131002073548-phpapp02.pptx
LESSON 7- Responsibility, Personal, Social and Moral Education (1).pptx
controlling-movement.pptx physical education
440252806-2-Problems-and-Chalengges-of-PE-and-Sports-K-12.pptx
controlling-movement.pdf VsdvsCsascasacasc
GEC-1-Midterm-Lecture3-The-Reform-and-Propaganda-Movement.pdf
Physical-Fitness-Skill-Related-Fitness.pdf
Fostering Responsibility, Morality, and Citizenship in.pptx.pdf
Lesson 2.pptx Pre - Spanish Period and Propaganda Movement
BPE-211.pptx Motor Learning and Motor COntrol
Ad

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Cell Structure & Organelles in detailed.
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
Pre independence Education in Inndia.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Institutional Correction lecture only . . .
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
Microbial disease of the cardiovascular and lymphatic systems
FourierSeries-QuestionsWithAnswers(Part-A).pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Cell Structure & Organelles in detailed.
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
RMMM.pdf make it easy to upload and study
Pre independence Education in Inndia.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Cell Types and Its function , kingdom of life
O5-L3 Freight Transport Ops (International) V1.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Insiders guide to clinical Medicine.pdf
Complications of Minimal Access Surgery at WLH
Institutional Correction lecture only . . .
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
GDM (1) (1).pptx small presentation for students
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Microbial diseases, their pathogenesis and prophylaxis

C06.ppt process management ajkdjsafjcsifjdfv

  • 2. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer() wait() WaitForSingleObject() C Program OS Process Mgr Memory Mgr Device Mgr File Mgr
  • 3. Process Management Responsibilities • Define & implement the essential characteristics of a process and thread – Algorithms to define the behavior – Data structures to preserve the state of the execution • Define what “things” threads in the process can reference – the address space (most of the “things” are memory locations) • Manage the resources used by the processes/threads • Tools to create/destroy/manipulate processes & threads • Tools to time-multiplex the CPU – Scheduling the (Chapter 7) • Tools to allow threads to synchronization the operation with one another (Chapters 8-9) • Mechanisms to handle deadlock (Chapter 10)
  • 4. Initializing the Machine • Power up  fetch-execute cycle begins • Initial (or hardware) process begins to run • Executes ROM diagnostic program • Then bootstrap loads the OS • OS initialization – Setup & initialize all system data structures (this creates process & resource abstractions) – Initialize all devices – Start daemons – including idle process – Branches to the scheduler
  • 5. Kernel Process j Process i ISRs Idle Process Hardware Process Starts Program Hardware process Switch to another program BIOS
  • 6. Process Abstraction Layers Control Unit Pi Address Space Pj Address Space Pk Address Space Hardware process (OS) coroutines across pi, pj, and pk under OS control Pi Control Unit Pj Control Unit Pk Control Unit pi, pj, and pk each have their own virtual machine OS interface Pi Virt Term Pj Virt Term Pk Virt Term pi, pj, and pk each have their own virtual terminal Window Mgr interface OS Address Space Process Mgr
  • 7. Process Manager Overview Program Process Abstract Computing Environment File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Memory Devices Process Mgr
  • 8. System Call Interface Unix Organization File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Memory Devices Libraries Process Process Process Monolithic Kernel
  • 9. NT Organization Processor(s) Main Memory Devices Libraries Process Process Process Subsystem User Supervisor Subsystem Subsystem Hardware Abstraction Layer NT Kernel NT Executive I/O Subsystem T T T T T T T T T
  • 10. Process Descriptor • OS creates/manages process abstraction • Descriptor is data structure for each process – Register values – Logical state – Type & location of resources it holds – List of resources it needs – Security keys – etc. (see Table 6.1 and the source code of your favorite OS)
  • 11. Creating a Process in UNIX pid = fork(); UNIX kernel … Process Table Process Descriptor
  • 12. Creating a Process in NT CreateProcess(…); Win32 Subsystem ntCreateProcess(…); … ntCreateThread(…); NT Executive NT Kernel … Handle Table Process Descriptor
  • 14. NT Process Descriptor KPROCESS (PCB) EPROCESS User Space Supervisor Space ETHREAD KTHREAD NTKernel NTExecutive
  • 15. NT Process Descriptor  Kernel process object including:  Pointer to the page directory  Kernel & user time  Process base priority  Process state  List of the Kernel thread descriptors that are using this process
  • 16. NT Process Descriptor (cont)  Parent identification  Exit status  Creation and termination times.  Memory status  Security information  executable image  Process priority class used by the thread scheduler.  A list of handles used by this process  A pointer to Win32-specific information
  • 17. Resource Model R = {Rj | 0  j < m} = resource types C = {cj  0 |  RjR (0  j < m)} = units of Rj available Reusable resource: After a unit of the resource has been allocated, it must ultimately be released back to the system. E.g., CPU, primary memory, disk space, … The maximum value for cj is the number of units of that resource Consumable resource: There is no need to release a resource after it has been acquired. E.g., a message, input data, … Notice that cj is unbounded. Resource: Anything that a process can request, then be blocked because that thing is not available.
  • 18. Using the Model • There is a resource manager, Mgr(Rj) for every Rj Mgr(Rj) pi can only request ni  cj units of reusable Rj pi can request unbounded # of units of consumable Rj • Process pi can request units of Rj if it is currently running Process request •Mgr(Rj) can allocate units of Rj to pi allocate release •pi can release units of Rj that it holds (reusable) or produces (consumable)
  • 19. Resource Manager Design Mgr(Rj) Process Resource Pool release request allocate allocate allocate release release
  • 21. Defining the Address Space • Some parts are built into the environment – Files – System services • Some parts are imported at runtime – Mailboxes – Network connections • Memory addresses are created at compile (and run) time
  • 22. The Compile Time Component Source Modules Translator Relocatable Modules Link Editor Absolute Program Loader Executable Program Primary Memory
  • 24. Process State (Version 1) Ready Blocked Running Start Schedule Request Done Request Allocate
  • 25. Process State (UNIX) Runnable Uninterruptible Sleep Running Start Schedule Request Done I/O Request Allocate zombie Wait by parent Sleeping Traced or Stopped Request I/O Complete Resume
  • 26. Process Hierarchies • Parent-child relationship may be significant: parent controls children’s execution Ready-Active Blocked-Active Running Start Schedule Request Done Request Allocate Ready-Suspended Blocked-Suspended Suspend Yield Allocate Suspend Suspend Activate Activate