Download Operating System Process Management: Representation, Control, and UNIX SVR4 and more Study notes Operating Systems in PDF only on Docsity!
Chapter 3
Process Description and Control
Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall
Roadmap
- (^) How are processes represented and controlled by the OS.
- (^) Process states which characterize the behaviour of processes.
- (^) Data structures used to manage processes.
- (^) Ways in which the OS uses these data structures to control process execution.
- (^) Discuss process management in UNIX SVR4.
Concepts
- (^) From earlier chapters we saw:
- (^) Computer platforms consists of a collection of hardware resources
- (^) Computer applications are developed to perform some task
- (^) It is inefficient for applications to be written directly for a given hardware platform
Concepts cont…
- (^) OS provides an interface for applications to use
- (^) OS provides a representation of resources that can be requested and accessed by application
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
- (^) 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
- (^) A process is comprised of:
- (^) Program code (possibly shared)
- (^) A set of data
- (^) A number of attributes describing the state of the process
Process Control Block
- (^) Contains the process elements
- (^) Created and managed by the operating system
- (^) Allows support for multiple processes
Trace of the Process
- (^) The 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
Trace from the
processes point of view:
- (^) Each process runs to completion
Trace from Processors
point of view
Timeout I/O TimeoutTimeout
Two-State Process Model
- (^) Process may be in one of two states
- (^) Running
- (^) Not-running
Queuing Diagram
Etc … processes moved by the dispatcher of the OS to the CPU then back to the queue until the task is competed
Process Creation
- (^) The OS builds a data structure to manage the process
- (^) Traditionally, the OS created all processes
- (^) But it can be useful to let a running process create another
- (^) This action is called process spawning
- (^) Parent Process is the original, creating, process
- (^) Child Process is the new process
Process Termination
- (^) There must be some way that a process can indicate completion.
- (^) This indication may be:
- (^) A HALT instruction generating an interrupt alert to the OS.
- (^) A user action (e.g. log off, quitting an application)
- (^) A fault or error
- (^) Parent process terminating