210 likes | 239 Views
Operating Systems. Process Control Management. Prepared by: Dhason. Topic & Structure of the lesson. Process Process States Process Scheduling. Learning Outcomes. At the end of this lecture YOU should be able to: - define the term process - identify process states
E N D
Operating Systems Process Control Management Prepared by: Dhason
Topic & Structure of the lesson • Process • Process States • Process Scheduling
Learning Outcomes • At the end of this lecture YOU should be able to: • - define the term process • - identify process states • - draw and explain process states using process • state diagrams • - describe how process scheduling works
Process • What is a process? • - it is a program in execution which progresses in a • sequential manner • - it is a unit of work with a unique process • identification • - requires resources like memory, CPU time and • files to complete its task • - resources are allocated when a process is created • or while in execution
Process (cont.) • the operating system creates and deletes user and • system processes • a process is active while a program is passive • the operating system keeps track of processes using a process table
Process State Diagram terminated new exit admitted Interrupt / time out ready running scheduler dispatch I/O or event wait I/O or event completion blocked
Process States • as a program executes, it changes states • New • -a process has just been created • Reasons for process creation • - new batch job • - interactive logon • a NEW process now becomes READY • Ready • - the process is waiting to be assigned to a processor
Process States (cont.) • READY - RUNNING • - instructions are being executed • - a process is using the CPU • - the number of running processes will depend on the • number of processors the computer has • A running process now can become BLOCKED, READY • or TERMINATED • A RUNNING process becomes BLOCKED when : • the process itself cannot execute because it is waiting • for an I/O operation to complete • - the process is waiting for some external event to happen
Process States (cont.) • From BLOCKED the process then becomes READY when: • - an event which the process was waiting for occurs • A RUNNING process becomes READY when: • - a process has reached its maximum allowable time for • uninterrupted execution
Process States (cont.) • From RUNNING the process then TERMINATES when: • - a process has completed • - a process has been aborted • Reasons for process termination • - normal completion • - invalid instruction • - memory unavailable • Control is then returned to the operating system
Quick Review Questions • For each of the following transitions between process states indicate whether the transition is possible or not possible? • ready running • ready new • blocked ready • On a system with n number of CPU’s what is the minimum number of processes that can be in the ready, running and blocked state?
Process Control Block (PCB) • Each process is represented in the operating system as • a process control block (PCB) • a PCB: • - keeps track of each process • - contains information associated with a specific • process • - serves as a repository of any information that may • vary from process to process
Process Control Block • Process state – the process states; ready, running, • blocked, terminated • Program counter – indicates the location for the next • instruction • Priority information - CPU scheduling information • Accounting information – statistics on CPU time, job and • process numbers • I/O status – list of I/O devices which are allocated to • processes
Process Scheduling • As processes enter the system, they are put on • the job queue • A new process is put on the ready queue • The process waits until it is selected for execution • or dispatched and given CPU resources • Once CPU is allocated the process then runs: • - the process could issue an I/O request and be • placed on a device queue or I/O queue • - the process could create a new sub-process • - the process could be forcibly removed
Quick Review Questions • What is a process control block?
Summary of Main Teaching Points • A process is a unit of work in execution which • requires resources. • The state of a process changes as it executes. • A process control block represents a process in the • operating system. • Processes can execute concurrently or • independently from each other.
Next Session CPU Scheduling