mplications of this new strategy More efficient processor utilization More processes may be maintained in main memory because only load in some of the pieces of each process More likely a process will be in the ready state at any particular time A process may be larger than main memory This restriction in programming is lifted OS automatically loads pieces of a process into main memory as required
6 Implications of this new strategy • More efficient processor utilization – More processes may be maintained in main memory because only load in some of the pieces of each process – More likely a process will be in the Ready state at any particular time • A process may be larger than main memory – This restriction in programming is lifted – OS automatically loads pieces of a process into main memory as required
Thrashing A condition in which the system spends most of its time swapping pieces rather than executing instructions It happens when OS frequently throws out a piece just before it is used To avoid this, OS tries to guess, based on recent history, which pieces are least likely to be used in the near future
7 Thrashing • A condition in which the system spends most of its time swapping pieces rather than executing instructions. • It happens when OS frequently throws out a piece just before it is used • To avoid this, OS tries to guess, based on recent history, which pieces are least likely to be used in the near future
Principle of locality Program and data references within a process tend to cluster only a few pieces of a process will be needed over a short period of time It is possible to make intelligent guesses about which pieces will be needed in the future, which avoids thrashing This suggests that virtual memory may work efficiently
8 Principle of Locality • Program and data references within a process tend to cluster → only a few pieces of a process will be needed over a short period of time • It is possible to make intelligent guesses about which pieces will be needed in the future, which avoids thrashing • This suggests that virtual memory may work efficiently
Performance of processes in vm environment Iw-iundumrenhraal Eau During the lifetime of the 也H L process, references are confined to a subset of pages 吗M邮 Execution time Figure 8.1 Hging Behavior
9 Performance of Processes in VM Environment • During the lifetime of the process, references are confined to a subset of pages
Support Needed for Virtual Memory Hardware must support paging and segmentation OS must be able to manage the movement of pages and/or segments between secondary memory and main memory 10
10 Support Needed for Virtual Memory • Hardware must support paging and segmentation • OS must be able to manage the movement of pages and/or segments between secondary memory and main memory