6.1 Process Description and Control Flashcards
Requirements of an OS
Process Management
OS must
-Execute multiple processes
-Allocate resources to processes and protect a process’ resources from other processes
-Enable processes to share and exchange information
-Enable synchronisation among processes
OS manages execution of applications
Resources are made available to multiple apps
Processor is switched among multiple application
Processor and I/O devices can be used efficiently
What is a process
A program in execution
An instance of a program running on a computer
The entity that can be assigned to and executed on a processor
Process Elements
Program code A set of data A number of attributes describing the state of the process -Identifier -State -Priority -Program Counter -Memory pointers -Context data -I/O Status info -Accounting info
Trace of the Process
Behavior of an individual process is shown by listing the sequence of instructions that are executed
This list is called a TRACE
DISPATCHER is a small program which switches the processor from one process to another
Two state process model
Processes can be either
- Running
- Not Running
Process Creation
The OS builds a data structure to manage the process
Traditionally the OS created all processes
-But it can be useful letting a running process create another
This action is called PROCESS SPAWNING
-PARENT PROCESS is the OG
-CHILD PROCESS is the new process
Process Termination
There must be some way that a process can indicate completion
Indication may be
-HALT instruction generating an interrupt alert to the OS
-A user action
-A fault or error
-Parent process terminating
Three state process model
Ready, Running and Blocked
READY
- A process in this state has been loaded into memory and is waiting to be assigned to the processor
- There could be several processes in this state at any time
RUNNING
-CPU registers hold values from this process and the current instruction sequence comes from this process
-There is only one process in this state at any time in a single processor system
BLOCKED
-A process in this state could not run even if the processor were free
-The process is usually waiting for a slow device to provide input or accept output - e.g. a process that is waiting for a user to enter data will be ‘blocked’ until the user types in data.
-There could be several processes in this state at any time
Suspended Processes
Processor is faster than I/O so all processes could be waiting for I/O
Blocked state now becomes suspend state when swapped to disk
Two new states
-Blocked/Suspend
-Ready/Suspend
Memory Tables
Used to keep track of main and secondary memory
Must include
- Allocation of main memory to processes
- Allocation of secondary memory to processes
- Protection attributes for access to shared memory regions
-Info needed to manage virtual memory
I/O Tables
Used by the OS to manage the I/O devices
OS needs to know
- Whether the I/O device is available or assigned
- Status of I/O operation
- Location in main memory being used as the source or destination of I/O transfer
File Tables
These tables provide info about -Existence of files -Location on secondary memory -Current Status Sometimes this info is maintained by a file management system
Process Tables
To manage processes the OS needs to know the details of the processes -Current state -Process ID -Location in memory Process control block -Process image
Process Attributes
We can group the process control block info into three general categories
- Process ID
- Processor state info
- Process control info