180 likes | 398 Views
PROCESS MANAGEMENT. DEFN OF PROCESS – A PROGRAM UNDER EXECUTION, WHICH COMPETES FOR THE CPU TIME & OTHER RESOURCES. CPU Switch From Process to Process. Diagram of Process State. PROCESS CONTROL BLOCK (PCB). * OS MAINTAINS INFORMATION OF EACH PROCESS IN A RECORD OR DATA STRUCTURE CALLED PCB.
E N D
PROCESS MANAGEMENT • DEFN OF PROCESS – A PROGRAM UNDER EXECUTION, WHICH COMPETES FOR THE CPU TIME & OTHER RESOURCES
PROCESS CONTROL BLOCK (PCB) * OS MAINTAINS INFORMATION OF EACH PROCESS IN A RECORD OR DATA STRUCTURE CALLED PCB
EACH USER PROCESS HAS A PCB. • IT IS CREATED WHEN A USER CREATES A PROCESS & IT IS REMOVED FROM THE SYSTEM WHEN THE PROCESS IS KILLED. • ALL THESE PCBs ARE KEPT IN MEM RESERVED FOR THE OS.
Ex: OS MAINTAINS 4 Q’ OR LISTS OF RUNNING PRS RDY PRS BLOCKED PRS & FREE PCB’
OPERATIONS ON A PROCESS CREATE A PROCESS KILL A PROCESS DISPATCH CHANGE PRIORITY OF A PROCESS BLOCK A PROCESS TIME –UP WAKE – UP
CREATE A PROCESS BEGIN 0 READ CUST – FILE ADD ….. 7 DIV…… 8 ………. 9 CALL “SORT” 10 ADD……….
1 ALL CPU REGS ARE SAVED BEFORE A NEW CHILD PROCESS IS CREATED & A PCB IS ALLOCATED TO IT. 2 THE OS CONSULTS LIST OF FREE PCBs’ & ACQUIRES A FREE PCB. PCB NO 8 IN FIG. 3 ASSIGNS PID = 8 FOR NEW PROCESS 4 UPDATES FREE PCB HEADER 1 9
5 OS COUSULTS IM FOR LOCN… OF SUB – PROGR.. ( STARTING ADDRS etc) 6 OS CONSULTS MM TO DET AVAIL ABILITY OF FREE MEM & ALLOCATES THOSE LOCNS 7 OS REQUESTS IM TO LOAD THE PROGR IN THE ALLOCATED MEM LOCNS 8 PRIORITY
9 PCB FIELDS OF PCB 8 ARE INITIALIZED 10 OS LINKS THIS PCB IN THE LIST OF RDY PROCESSES. ROUND ROBIN (13,4,14,7,8) PRIORITY – etc PRESUMING HIGHEST PRIORITY RDY- 8,13,4,14,7
5 OS COUSULTS IM FOR LOCN… OF SUB – PROGR.. ( STARTING ADDRS etc) 6 OS CONSULTS MM TO DET AVAIL ABILITY OF FREE MEM & ALLOCATES THOSE LOCNS 7 OS REQUESTS IM TO LOAD THE PROGR IN THE ALLOCATED MEM LOCNS 8 PRIORITY