Download presentation
1
Process Description and Control
Chapter 3
2
Process Requirements of an Operating System
Interleave execution of several processes to maximize processor utilization while providing reasonable response time Allocate resources to processes Support interprocess communication and user creation of processes
3
Process Also called a task or job It is a program in execution
it is an active entity
4
Two-State Process Model
Dispatch Enter Not Running Running Exit Pause State transition diagram Queue Processor Enter Dispatch Exit Pause Queuing diagram
5
Reasons for Process Creation
Submission of a batch job User logs on Created by OS to provide a service such as printing Spawned by an existing process
6
Reasons for Process Termination
Normal completion e.g., user logs off, requests termination Error and fault conditions e.g., time limit exceeded, memory unavailable OS intervention e.g., when deadlock occurs Parent request
7
Processes Ready Blocked
prepared to execute Blocked waiting for I/O Dispatcher cannot just select the process that has been in the queue the longest because it may be blocked
8
A Five-State Model Running Ready Blocked New Exit
process currently being executed Ready prepared to execute Blocked waiting for some event to occur New created but not admitted to job pool Exit released from job pool
9
Five-State Process Model
Dispatch Release Admit New Ready Running Exit Time-out Event Wait Event Occurs Blocked
10
Single Blocked Queue Ready Queue Release Dispatch Admit Processor
Time-out Event Wait Event Occurs Blocked Queue
11
Multiple Blocked Queues
Ready Queue Release Dispatch Admit Processor Time-out Event 1 Wait Event 1 Queue Event 1 Occurs . . . Event n Wait Event n Queue Event n Occurs
12
Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Swap these processes to disk to free up more memory Blocked state becomes suspend state when swapped to disk Two new states Blocked, suspend Ready, suspend
13
Process State Transition Diagram with Two Suspend States
New Admit Suspend Admit Dispatch Activate Ready, suspend Ready Running Exit Suspend Time out Event Wait Event Occurs Event Occurs Activate Blocked, suspend Blocked
14
Operating System Control Structures
Tables are constructed for each entity the operating system manages memory tables I/O tables file tables process tables
15
Memory Tables Allocation of main memory to processes
Allocation of secondary memory to processes Protection attributes for main or virtual memory Information needed to manage virtual memory
16
I/O Tables I/O device is available or assigned Status of I/O operation
Location in main memory being used as the source or destination of the I/O transfer
17
File Tables Existence of files Location on secondary memory
Current Status (e.g., open) Attributes (e.g., permissions) Sometimes this information is maintained by a file-management system
18
Process Table Process image is a collection: user program user data
program or set of programs to be executed user data locations for local and global variables, defined constants run-time stack LIFO stack to keep track of procedure calls, parameters passed process control block (PCB) attributes used by the OS for process control
19
Contents of the Process Control Block
Process identification user id, process id, id of parent Process state information user visible registers control and status registers stack pointers
20
Contents of PCB (cont’d)
Process control information scheduling and state information data structuring interprocess communication process privileges memory management resource ownership and utilization
21
Typical Functions of an Operating System Kernel
Process management Memory management I/O management Support functions
22
Process Management Process creation and termination
Process scheduling and dispatching Process switching Process synchronization and support for inter-process communication Management of process control blocks
23
Memory Management Allocation of address space to processes Swapping
Page and segment management
24
I/O Management and Support Functions
Buffer management Allocation of I/O channels and devices to processes Interrupt handling Accounting Monitoring
25
Steps in Process Creation
Assign a unique process identifier Allocate space for the process Initialize process control block Set up appropriate linkages e.g., add new process to linked list used for scheduling queue Other maintain an accounting file
26
When to Context Switch Interrupts Trap Supervisor call
react to an asychronous external event e.g., clock, I/O, memory fault Trap associated with execution of current instruction e.g, handle error or exceptional condition Supervisor call explicit request, e.g., open file
27
Steps in a Context Switch
Save context of “old” process Update “old” PCB with the new state and any accounting information Move “old” PCB to appropriate queue Select a “new’’ process for execution Update PBC of “new” process Update memory management tables Restore context of “new” process
28
Execution of the OS Nonprocess kernel Execution within user processes
execute kernel outside of any process OS code is executed as a separate entity that operates in privileged mode Execution within user processes OS software within context of a user process process executes in privileged mode when executing OS code Process-based operating system major kernel functions are separate processes a process is invoked by the OS
29
UNIX Process State Transition Diagram
fork Created Preempted return to user enough memory not enough memory (swapping system only) User Running preempt swap out return reschedule process Ready to Run in Memory Ready to Run Swapped swap in system call, interrupt Kernel Running sleep wakeup wakeup interrupt, interrupt return exit Asleep in Memory swap out Sleep, Swapped Zombie
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.