Download presentation
Presentation is loading. Please wait.
Published byHugh Cowlishaw Modified over 9 years ago
1
CSC 350 - Dr. Gary Locklair Process Management Wassn4 due today
2
CSC 350 - Dr. Gary Locklair PC Operating Systems
3
CSC 350 - Dr. Gary Locklair Processor Management I. Processor management good background in CS:AO pages 132ff
4
CSC 350 - Dr. Gary Locklair Processor Management I. Processor management - process is “unaware” - OS must “manage”
5
CSC 350 - 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
6
CSC 350 - Dr. Gary Locklair Process Management II. Process management without supervision, two “bad things” are possible …
7
CSC 350 - Dr. Gary Locklair Process Management - deadlock
8
CSC 350 - Dr. Gary Locklair No, those are dread- locks Deadlock?
9
CSC 350 - Dr. Gary Locklair Good Bye! Bad Guy w/ Dreadlocks
10
CSC 350 - Dr. Gary Locklair Process Management - deadlock multiple processes blocked by competition
11
CSC 350 - Dr. Gary Locklair Process Management - deadlock example 2 kindergartners … one with brush, the other with the paint
12
CSC 350 - Dr. Gary Locklair Process Management - starvation a process is never satisfied
13
CSC 350 - Dr. Gary Locklair Process Management - starvation example kind kindergartner waiting for the blocks
14
CSC 350 - Dr. Gary Locklair Process Management How should the OS allocate resources? range of policies liberal conservative
15
CSC 350 - Dr. Gary Locklair Process Management II. Process management A. Deadlock 1. Definition
16
CSC 350 - Dr. Gary Locklair Process Management 1. Definition two or more processes are attempting to obtain the same non- shareable resource
17
CSC 350 - Dr. Gary Locklair Process Management A. Deadlock usually results from liberal policies
18
CSC 350 - Dr. Gary Locklair Process Management
19
CSC 350 - Dr. Gary Locklair Process Management
20
CSC 350 - 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
21
CSC 350 - Dr. Gary Locklair Process Management 1. Definition b. example process A and process B both attempt to print at same time
22
CSC 350 - Dr. Gary Locklair Process Management A. Deadlock 2. conditions a. mutual exclusion
23
CSC 350 - Dr. Gary Locklair Process Management 2. conditions b. resource holding c. non-preemption d. circular wait
24
CSC 350 - Dr. Gary Locklair PC Operating Systems
25
CSC 350 - 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
26
CSC 350 - 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
27
CSC 350 - 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
28
CSC 350 - 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
29
CSC 350 - Dr. Gary Locklair Sassn3 working code due in 1 week if you have good pseudocode, extensions are possible …
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.