File System Implementation CSCI 444/544 Operating Systems Fall 2008.
CSCI-3753: Operating Systems Fall 2018
Transcript of CSCI-3753: Operating Systems Fall 2018
![Page 1: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/1.jpg)
CSCI-3753: Operating SystemsFall 2018
Anh NguyenDepartment of Computer Science University of Colorado Boulder
![Page 2: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/2.jpg)
Week 12: PA 4
CSCI 3753 Fall 2018 2
![Page 3: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/3.jpg)
Assignment Goal
CSCI 3753 Fall 2018 3
• Implement a paging strategy that a paging simulator can use to maximize the performance of the memory access in a set of pre-defined programs
•Action items• Implement LRU algorithm • pager-lru.c
• Implement any form of predictive paging algorithm• pager-predict.c
![Page 4: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/4.jpg)
Source Code
CSCI 3753 Fall 2018 4
• Github code:https://github.com/asayler/CU-CS3753-PA4
•Note:• simulator.c has been updated for this assignment• If you use code from github, be sure to update line 68 as
follows:
static inline void assert(int boolean,char *boolstr, char *file, int line)
![Page 5: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/5.jpg)
Paging Simulator
CSCI 3753 Fall 2018 5
•Run a random set of 5 pre-defined programs utilizing a limited number of shared physical pages
•Provide default values in simulator.h• 20 virtual pages per process (MAXPROCPAGES) • 100 physical pages (frames) in total (PHYSICALPAGES) • 20 simultaneous processes competing for pages
(MAXPROCESSES) • 128 memory unit page size (PAGESIZE) • 100 tick delay to swap a page in or out (PAGEWAIT)• Each instruction or step in the simulated programs requires 1 tick
to complete.
![Page 6: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/6.jpg)
Paging Simulator
CSCI 3753 Fall 2018 6
•Provide 3 functions for interaction
•To control the allocation of virtual and physical pages• pagein()• pageout()
•To handle the page fault• pageit() ß core paging function that needs implementation
•Source code is provided.• simulator.h, simulator.c• pager-basic.c, pager-lru.c, pager-predict.c
![Page 7: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/7.jpg)
pager-basic.c
CSCI 3753 Fall 2018 7
•A basic “one-process-at-a-time” implementation•A simple demonstration of the simulator API
•DON’T need any implementation from YOU !!!
![Page 8: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/8.jpg)
pager-basic.c
CSCI 3753 Fall 2018 8
Your paging strategy mostly goes to this part.Select a Process
Determine Current Page
(pc / PAGESIZE)
Exit pageit()
Select aPage to Evict
Is Page Swapped In?
Remaining Processes?
Call pagein()
Call pageout()
Investigate Error
Simulator calls pageit()
Yes
Yes
No
No
Success
Failure
Failure
Success
![Page 9: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/9.jpg)
pager-basic.c
Select a ProcessDetermine
Current Page(pc / PAGESIZE)
Exit pageit()
Select aPage to Evict
Is Page Swapped In?
Remaining Processes?
Call pagein()
Call pageout()
Investigate Error
Simulator calls pageit()
Yes
Yes
No
No
Success
Failure
Failure
Success
![Page 10: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/10.jpg)
pager-lru.c
CSCI 3753 Fall 2018 10
Spend most of your time deciding how to implement itSelect a Process
Determine Current Page
(pc / PAGESIZE)
Exit pageit()
Select aPage to Evict
Is Page Swapped In?
Remaining Processes?
Call pagein()
Call pageout()
Investigate Error
Simulator calls pageit()
Yes
Yes
No
No
Success
Failure
Failure
Success
![Page 11: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/11.jpg)
pager-lru.c
Select a ProcessDetermine
Current Page(pc / PAGESIZE)
Exit pageit()
Select aPage to Evict
Is Page Swapped In?
Remaining Processes?
Call pagein()
Call pageout()
Investigate Error
Simulator calls pageit()
Yes
Yes
No
No
Success
Failure
Failure
Success
![Page 12: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/12.jpg)
pager-predict.c
CSCI 3753 Fall 2018 12
•Require a predictive algorithm that• Attempts to predict what pages each process will require
in the future and then
• Swaps these pages in before they are needed
• Note: In any predictive operation, you ideally wish to stay 100-200 ticks ahead of the execution of each process.
![Page 13: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/13.jpg)
pager-predict.c
CSCI 3753 Fall 2018 13
Spend most of your time deciding how to implement it
Select a Process
Determine Current Page
(pc / PAGESIZE)
Exit pageit()
Select aPage to Evict
Is Page Swapped In?
Remaining Processes?
Call pagein()
Call pageout()
Investigate Error
Simulator calls pageit()
Yes
Yes
No
No
Success
Failure
Failure
Success
DetermineFuture Page(More Magic)
Repeat 2x for Both Current and Future Paths
Check for Previous Prediction Miss
Attempt to Setup Future Prediction Hit
![Page 14: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/14.jpg)
pager-predict.c
Select a Process
Determine Current Page
(pc / PAGESIZE)
Exit pageit()
Select aPage to Evict
Is Page Swapped In?
Remaining Processes?
Call pagein()
Call pageout()
Investigate Error
Simulator calls pageit()
Yes
Yes
No
No
Success
Failure
Failure
Success
DetermineFuture Page(More Magic)
Repeat 2x for Both Current and Future Paths
Check for Previous Prediction Miss
Attempt to Setup Future Prediction Hit
![Page 15: CSCI-3753: Operating Systems Fall 2018](https://reader035.fdocuments.us/reader035/viewer/2022062321/62a9e008b3cad14dcf4513ba/html5/thumbnails/15.jpg)
Week 12 – Checklist
q Discuss PS3q Discuss PA4
CSCI 3753 Fall 2018 15