CSC Dr. Gary Locklair Process Management Wassn4 due today
CSC Dr. Gary Locklair PC Operating Systems
CSC Dr. Gary Locklair Processor Management I. Processor management good background in CS:AO pages 132ff
CSC Dr. Gary Locklair Processor Management I. Processor management - process is “unaware” - OS must “manage”
CSC Dr. Gary Locklair Job and Process States Hold Ready Running Waiting I/O or event completion Scheduler dispatch I/O or event wait Admitted InterruptExit Finished Handled by Process Scheduler Handled by Job Scheduler Identify cause of state change
CSC Dr. Gary Locklair Process Management II. Process management without supervision, two “bad things” are possible …
CSC Dr. Gary Locklair Process Management - deadlock
CSC Dr. Gary Locklair No, those are dread- locks Deadlock?
CSC Dr. Gary Locklair Good Bye! Bad Guy w/ Dreadlocks
CSC Dr. Gary Locklair Process Management - deadlock multiple processes blocked by competition
CSC Dr. Gary Locklair Process Management - deadlock example 2 kindergartners … one with brush, the other with the paint
CSC Dr. Gary Locklair Process Management - starvation a process is never satisfied
CSC Dr. Gary Locklair Process Management - starvation example kind kindergartner waiting for the blocks
CSC Dr. Gary Locklair Process Management How should the OS allocate resources? range of policies liberal conservative
CSC Dr. Gary Locklair Process Management II. Process management A. Deadlock 1. Definition
CSC Dr. Gary Locklair Process Management 1. Definition two or more processes are attempting to obtain the same non- shareable resource
CSC Dr. Gary Locklair Process Management A. Deadlock usually results from liberal policies
CSC Dr. Gary Locklair Process Management
CSC Dr. Gary Locklair Process Management
CSC Dr. Gary Locklair Process Management 1. Definition a. example process A requests tape process B requests printer process B requests tape process A requests printer
CSC Dr. Gary Locklair Process Management 1. Definition b. example process A and process B both attempt to print at same time
CSC Dr. Gary Locklair Process Management A. Deadlock 2. conditions a. mutual exclusion
CSC Dr. Gary Locklair Process Management 2. conditions b. resource holding c. non-preemption d. circular wait
CSC Dr. Gary Locklair PC Operating Systems
CSC Dr. Gary Locklair Systems Assignment 3 A // OS Simulator // Program will simulate the actions of a demand paging memory manager // // Input: data file used to simulate Jobs page requests // format of each record: X Y // where Job X requests Page Y // // Output: after each request, display the current PMT, MMT, and // page replacement success rate // // Process: for each Job’s request, OS must determine if page is in RAM // if not, then a page fault occurs and page is loaded into RAM // if there is no free RAM page, then page replacement occurs // using a FIFO scheme #include #include // header for file I/O
CSC Dr. Gary Locklair Systems Assignment 3 A type? FIFO_page_replacement (args?) // function to determine which page to replace (“kick out”) of RAM when RAM // page frames are full type? Display (args?) // function to display Page Map Table, Memory Map Table, and success rate // Page Map Table format; one for each Job: // Job Page # | Page Frame # // If Page is not in RAM, Page Frame # states disc // Memory Map Table; one for system: // Frame # | Job # // If Frame is not used, Job # states free // success_rate = page_success / page_request
CSC Dr. Gary Locklair Systems Assignment 3 A int main( void ) { const maxjobs = 3, maxpages = 5, frames = 4; int jobnumber, pagenumber; ifstream inFile; // inFile is an Input file stream inFile.open("osdata.txt"); // associate data file with file stream // and open it for use inFile >> jobnumber >> pagenumber; // read Job and Page from file // if not EOF, then inFile is True
CSC Dr. Gary Locklair Systems Assignment 3 A while (inFile) { // page_request++ // IF Job X’s Page Y currently in RAM // THEN //NO PAGE FAULT //page_success++ // ELSE // PAGE FAULT //page_fault++ // IF RAM IS FULL //FIFO_page_replacement // LOAD Job’s X Page Y INTO FREE PAGE FRAME // Display inFile >> jobnumber >> pagenumber; // read Job and Page from file
CSC Dr. Gary Locklair Sassn3 working code due in 1 week if you have good pseudocode, extensions are possible …