Operating Systems
Operating Systems
• 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
• A unit of activity characterized by the execution
of a sequence of instructions, a current state,
and an associated set of system instructions
Process Elements
Identifier
Program
State Priority
counter
8
Process Control Block
• Consider three
processes being
executed
• All are in memory (plus
the dispatcher)
• Lets ignore virtual
memory for this.
Roadmap
Creation Termination
New batch job Normal Completion
Interactive Login Memory unavailable
Created by OS to Protection error
provide a service
Spawned by existing Operator or OS
process Intervention
Process Creation
Reason Comment
Swapping The OS needs to release sufficient main
memory to bring in a process that is ready
to execute.
Other OS Reason OS suspects process of causing a problem.
Interactive User e.g. debugging or in connection with the use
Request of a resource.
Timing A process may be executed periodically
(e.g., an accounting or system monitoring
process) and may be suspended while
waiting for the next time.
Parent Process A parent process may wish to suspend
Request execution of a descendent to examine or
modify the suspended process, or to
coordinate the activity of various
descendants.
Roadmap
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
I
V V
I A V R N O O D I T S Z A P C
0 0 0 0 0 0 0 0 0 0 I I 0 0 0 1
D C M F T P F F F F F F F F F
P F
L
A process switch may occur any time that the OS has gained
control from the currently running process. Possible events
giving OS control are:
Process table entry Defines state of a process; this information is always accessible to
the operating system
U (user) area Process control information that needs to be accessed only in the
context of the process
Per process region table Defines the mapping from virtual to physical addresses; also
contains a permission field that indicates the type of access
allowed the process: read-only, read-write, or read-execute
Kernel stack Contains the stack frame of kernel procedures as the process
executes in kernel mode 50
Process Creation
54