Unformatted text preview:

CS162 Operating Systems and Systems Programming Lecture 12 Introduction in Networking March 2 2011 Ion Stoica http inst eecs berkeley edu cs162 Goals for Today Finish Page Replacement Working Set Thrashing Introduction to networking 3 2 Note Some slides and or pictures in the following are adapted from slides 2005 Silberschatz Galvin and Gagne Many slides generated from my lecture notes by Kubiatowicz Vern Paxson and Randy Katz Ion Stoica CS162 UCB Spring 2011 Lec 11 2 Allocation of Page Frames Memory Pages How do we allocate memory among different processes Does every process get the same fraction of memory Different fractions Should we completely swap some processes out of memory Each process needs minimum number of pages Want to make sure that all processes that are loaded into memory can make forward progress Example IBM 370 6 pages to handle SS MOVE instruction instruction is 6 bytes might span 2 pages 2 pages to handle from 2 pages to handle to Possible Replacement Scopes Global replacement process selects replacement frame from set of all frames one process can take a frame from another Local replacement each process selects from only its own set of allocated frames 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 3 Fixed Priority Allocation Equal allocation Fixed Scheme Every process gets same amount of memory Example 100 frames 5 processes process gets 20 frames Proportional allocation Fixed Scheme Allocate according to the size of process Computation proceeds as follows si size of process pi and S si m total number of frames si m ai allocation for pi S Priority Allocation Possible behavior If process pi generates a page fault select for replacement a frame from a process with lower priority number Other schemes Change adaptively during process lifetime 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 4 Page Fault Frequency Allocation Can we reduce Capacity misses by dynamically changing the number of pages application Establish acceptable page fault rate If actual rate too low process loses frame If actual rate too high process gains frame Question What if we just don t have enough memory 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 5 Thrashing If a process does not have enough pages the page fault rate is very high This leads to low CPU utilization operating system spends most of its time swapping to disk Thrashing a process is busy swapping pages in and out Questions How do we detect Thrashing What is best response to Thrashing 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 6 Locality In A Memory Reference Pattern Program Memory Access Patterns have temporal and spatial locality Group of Pages accessed along a given time slice called the Working Set Working Set defines minimum number of pages needed for process to behave well Not enough memory for Working Set Thrashing Better to swap out process 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 7 Working Set Model working set window fixed number of page references Example 10 000 instructions WSi working set of Process Pi total set of pages referenced in the most recent varies in time if too small will not encompass entire locality if too large will encompass several localities if will encompass entire program D WSi total demand frames if D m Thrashing Policy if D m then suspend swap out processes This can improve overall system behavior by a lot 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 8 What about Compulsory Misses Recall that compulsory misses are misses that occur the first time that a page is seen Pages that are touched for the first time Pages that are touched after process is swapped out swapped back in Clustering On a page fault bring in multiple pages around the faulting page Since efficiency of disk reads increases with sequential reads makes sense to read several sequential pages Working Set Tracking Track working set of application When swapping process back in swap in working set 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 9 Demand Paging Summary Replacement policies FIFO Place pages on queue replace page at end MIN Replace page that will be used farthest in future LRU Replace page used farthest in past Clock Algorithm Approximation to LRU Arrange all pages in circular list Sweep through them marking as not in use If page not in use for one pass than can replace Nth chance clock algorithm Another approx LRU Give pages multiple passes of clock hand before replacing Second Chance List algorithm Yet another approx LRU Divide pages into two groups one of which is truly LRU and managed on page faults Working Set Set of pages touched by a process recently Thrashing a process is busy swapping pages in and out Process will thrash if working set doesn t fit in memory Need to swap out a process 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 10 Administrivia Project 2 will be out today Midterm next week Wednesday March 9th Closed book one page of hand written notes both sides Midterm Topics Everything up to this Wednesday March 2nd 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 11 5min Break 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 12 What do this two have in Common Johann Gutenberg 1398 1468 First printing press Key idea splitting up text in individual components E g lower upper case letters The Internet Bible first mass produced book Both Both lower lower the the cost cost of of distributing distributing information information 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 13 The ARPANet SRI 940 IMPs Utah PDP 10 UCSB IBM 360 UCLA Sigma 7 BBN team that implemented the interface message processor 3 2 Paul Baran RAND Corp early 1960s Communications networks that would survive a major enemy attack ARPANet Research vehicle for Resource Sharing Computer Networks 2 September 1969 UCLA first node on the ARPANet December 1969 4 nodes connected by phone lines Ion Stoica CS162 UCB Spring 2011 Lec 11 14 ARPANet Evolves into Internet ARPANet SATNet PRNet 1965 TCP IP 1975 NSFNet Deregulation SaS Commercialization ASP AIP WWW 1985 1995 2008 SATNet Satelite network PRNet Radio Network Web Hosting Multiple ISPs Internet2 Backbone Internet Exchanges 3 2 Application Hosting ASP Application Service Provider SaS Software as a Service Provider e commerce tookit etc Ion Stoica CS162 UCB Spring 2011 Lec 11 15 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 16 3 2 Ion Stoica CS162 UCB Spring 2011 17 Lec 11 17 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 18 Network Cloud 3 2 Ion Stoica CS162 UCB Spring 2011 Lec 11 19 Regional Nets Backbone Regional Net Regional Net


View Full Document

Berkeley COMPSCI 162 - Lecture 12 Introduction in Networking

Documents in this Course
Lecture 1

Lecture 1

12 pages

Nachos

Nachos

41 pages

Security

Security

39 pages

Load more
Loading Unlocking...
Login

Join to view Lecture 12 Introduction in Networking and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 12 Introduction in Networking and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?