9.1 silberschatz, galvin and gagne ©2003 operating system concepts chapter 9: virtual-memory...

48
9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Chapter 9: Virtual-Memory Management Management Background Demand Paging Page Replacement Allocation of Frames Thrashing Operating System Examples

Upload: estella-blankenship

Post on 14-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.1 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Chapter 9: Virtual-Memory Chapter 9: Virtual-Memory ManagementManagement

Background

Demand Paging

Page Replacement

Allocation of Frames

Thrashing

Operating System Examples

Page 2: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.2 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

BackgroundBackground

Virtual memory – separation of user logical memory from physical memory, which allows the execution of processes that may not be completely in memory. Only part of the program needs to be in memory for execution.

Logical address space can therefore be much larger than physical address space.

Allows address spaces to be shared by several processes.

Allows for more efficient process creation.

Virtual memory is commonly implemented with demand paging.

Page 3: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.3 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Virtual Memory That is Larger Than Physical MemoryVirtual Memory That is Larger Than Physical Memory

Page 4: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.4 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

The ability to execute a program that is only partially in memory would provide many benefits:

A program would no longer be constrained by the amount of available physical memory. Users would be able to write programs for a very large virtual address space, simplifying the programming task.

Because each user program could take less physical memory, more programs could be run at the same time, with a corres-ponding increase in CPU utilization and throughput.

Less I/O would be needed to load or swap each user program into memory, so each user program would run faster.

Page 5: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.5 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Demand PagingDemand Paging

Bring a page into memory only when it is needed. Less I/O needed

Less memory needed

Faster response

More users

If there is a reference to a page, then the page is needed. invalid reference abort

not-in-memory (page fault) bring to memory

Page 6: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.6 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Transfer of a Paged Memory to Contiguous Disk SpaceTransfer of a Paged Memory to Contiguous Disk Space

Page 7: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.7 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Valid-Invalid BitValid-Invalid Bit

With each page table entry, a valid–invalid bit is associated(1 in-memory, 0 not-in-memory)

Initially valid–invalid bit is set to 0 on all entries.

During address translation, if valid–invalid bit in page table entry is 0 page fault.

Page 8: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.8 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page Table When Some Pages Are Not in Main MemoryPage Table When Some Pages Are Not in Main Memory

Page 9: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.9 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Handling a Page FaultHandling a Page Fault

If there is ever a reference to a page marked invalid, first reference will trap to OS page fault trap

OS handles the page fault as follows:

1. Check an internal table (kept with PCB) to determine whether the reference was a valid or invalid memory access.

2. If the reference was invalid, terminate the process. If it was valid, but the page need to be brought in.

3. Find a free frame.

4. Schedule a disk operation to read the desired page into the newly allocated frame.

5. When the disk read is complete, modify the internal table in the PCB and the page table to indicate that the page is now in memory.

6. Restart the instruction that was interrupted by the page fault trap. The process can now access the page as though it had always been in memory.

Page 10: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.10 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Steps in Handling a Page FaultSteps in Handling a Page Fault

Page 11: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.11 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Performance of Demand PagingPerformance of Demand Paging

Page Fault Rate 0 p 1.0 if p = 0, no page faults

if p = 1, every reference is a fault

Effective Access Time (EAT)

EAT = (1 – p) x memory access time

+ p x page fault time

Three major components of the page-fault service time:

1. Service the page-fault interrupt.

2. Read in the page.

3. Restart the process.

Page 12: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.12 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

What happens if there is no free frame?What happens if there is no free frame?

Page replacement – find some page in memory, but not really in use, swap it out. A good algorithm is needed.

Performance issue: we want an algorithm which will result in minimum number of page faults.

Same page may be brought into memory several times.

Page 13: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.13 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Need For Page ReplacementNeed For Page Replacement

Page 14: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.14 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Basic Page ReplacementBasic Page Replacement

1. Find the location of the desired page on disk.

2. Find a free frame:- If there is a free frame, use it.- If there is no free frame, use a page replacement

algorithm to select a victim frame.

- Write the victim page to the disk; update the page and

frame tables accordingly.

1. Read the desired page into the (newly) free frame. Update the page and frame tables.

2. Restart the user process.

Page 15: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.15 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page ReplacementPage Replacement

Page 16: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.16 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page ReplacementPage Replacement

Handle over-allocation of memory by modifying page-fault service routine to include page replacement.

Use modify (dirty) bit to reduce overhead of page transfers – only modified pages are written to disk.

Page replacement completes separation between logical memory and physical memory – large virtual memory can be provided on a smaller physical memory.

Page 17: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.17 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page Replacement AlgorithmsPage Replacement Algorithms

Want lowest page-fault rate.

Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string.

How is a reference string generated?

For example, if we trace a particular process, we might record the following address reference sequence: 0100, 0432, 0101, 0612, 0102, 0103, 0104, 0101, 0611, 0102

which, at 100 bytes per page, is reduced to the following reference string: 1, 4, 1, 6, 1, 6, 1

Page 18: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.18 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Expected (Ideal)Expected (Ideal)Graph of Page Faults Versus The Number of FramesGraph of Page Faults Versus The Number of Frames

Page 19: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.19 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

First-In-First-Out (FIFO) AlgorithmFirst-In-First-Out (FIFO) Algorithm Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 3 frames (3 pages can be in memory at a time per process)

4 frames

This shows the Belady’s Anomaly more frames more page faults

1

2

3

1

2

3

4

1

2

5

3

4

9 page faults

1

2

3

1

2

3

5

1

2

4

5 10 page faults

44 3

Page 20: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.20 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

FIFO Page Replacement Algorithm:FIFO Page Replacement Algorithm:another exampleanother example

Page 21: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.21 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

FIFO Replacement Illustrating FIFO Replacement Illustrating Belady’s AnomalyBelady’s Anomaly

Page 22: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.22 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Optimal AlgorithmOptimal Algorithm

Replace the page that will not be used for the longest period of time.

4 frames example

1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

Requires future knowledge of the reference string.

Used for measuring how well your algorithm performs.

1

2

3

4

6 page faults

4 5

Page 23: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.23 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Optimal Page ReplacementOptimal Page Replacement

Page 24: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.24 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Least Recently Used (LRU) AlgorithmLeast Recently Used (LRU) Algorithm

Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

Replace the page that has not been used for the longest period of time.

This strategy is the optimal page-replacement algorithm looking backward in time, rather than forward.

1

2

3

5

4

4 3

5

Page 25: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.25 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

LRU Page ReplacementLRU Page Replacement

Page 26: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.26 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

LRU Algorithm ImplementationLRU Algorithm Implementation

Counter implementation Every page entry has a counter; every time page is referenced

through this entry, copy the clock into the counter.

When a page needs to be changed, look at the counters to determine which page to replace. (The page with the smallest time value)

Stack implementation – keep a stack of page numbers in a double link form: Page referenced:

move it to the top

The LRU page is at the bottom

No search needed for replacement

Page 27: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.27 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Use Of A Stack to Record The Most Recent Page ReferencesUse Of A Stack to Record The Most Recent Page References

Page 28: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.28 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

LRU Approximation AlgorithmsLRU Approximation Algorithms

Reference bit With each page, associate a bit, initially = 0

When a page is referenced, its reference bit is set to 1.

Replace the one which is 0 (if one exists). We do not know the order, however.

Second-chance (clock) algorithm It's a modified FIFO algorithm with reference bit.

When a page has been selected to be replaced, we inspect its reference bit.

If the bit is 0, we replace the page. If the bit is 1, we give the page a second chance and move on to select the next FIFO page with the same rules.

When a page gets a second chance, its reference bit is reset to 0 and its arrival time is reset to the current time.

A page that is given a second chance will not be replaced until all other pages are replaced or given second chances.

Page 29: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.29 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Second-Chance (clock) Page-Replacement AlgorithmSecond-Chance (clock) Page-Replacement Algorithm

Page 30: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.30 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page-Buffering AlgorithmPage-Buffering Algorithm

In addition to a page-replacement algorithm, the system keeps a pool of free frames.

When a page fault occurs, a victim frame is chosen as before. However, the desired page is load into a free frame from the pool before the victim page is written out.

This procedure allows the process to restart as soon as possible, without waiting for the victim page to be written out.

When the victim page is later written out, its frame is added to the free-frame pool.

Page 31: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.31 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Allocation of FramesAllocation of Frames

How do we allocate the fixed amount of free memory among the various processes?

Each process needs a minimum number of frames.

The minimum number of frames is defined by the computer architecture (instruction set).

The maximum number of frames is defined by the amount of available physical memory.

Two major allocation schemes. fixed allocation

priority allocation

Page 32: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.32 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Fixed AllocationFixed Allocation

Equal allocation – e.g., if there are 100 frames and 5 processes, then each process gets 20 frames.

Proportional allocation – Allocate according to the size of process.

mS

spa

m

sS

ps

iii

i

ii

for allocation

frames ofnumber total

process of size

5964137

127

564137

10

127

10

64

2

1

2

1

a

a

s

s

m

Page 33: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.33 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Priority AllocationPriority Allocation

Use a proportional allocation scheme, using priorities rather than size.

If process Pi generates a page fault,

select for replacement one of its frames.

select for replacement a frame from a process with lower priority.

Page 34: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.34 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Global vs. Local AllocationGlobal vs. Local Allocation

Global replacement – process selects a replacement frame from the 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.

Page 35: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.35 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

ThrashingThrashing

If a process does not have “enough” pages, the page-fault rate is very high. This leads to: low CPU utilization.

operating system thinks that it needs to increase the degree of multiprogramming.

another process added to the system, causing more page faults.

Thrashing busy swapping pages in and out

doing more paging than executing

A process is thrashing if it is spending more time paging than executing.

Page 36: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.36 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Thrashing Thrashing

To prevent thrashing, we must provide a process as many frames as it needs.

But how do we know how many frames it needs?

By the locality model of process execution.

Page 37: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.37 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

The Locality ModelThe Locality Model

The Locality model says that: as a process executes, it moves from one locality to another.

A locality is a set of pages that are actively used together by a process.

A program is generally composed of several localities, which may overlap. For example, when a method is called, it defines a new locality.

Why does thrashing occur?If we allocate fewer frames than the size of the current locality, the process will thrash, since it cannot keep in memory all the pages that it is actively using.

Page 38: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.38 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Locality In A Memory-Reference PatternLocality In A Memory-Reference Pattern

Page 39: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.39 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Working-Set ModelWorking-Set Model

It is based on the assumption of locality.

working-set window a fixed number of the most recent page references Example: 10,000 page references

The set of pages in the most recent page references is the working set.

The working set is an approximation of the program's current locality.

If a page is in active use, it will be in the working set. If it is no longer being used, it will drop from the working set time units after its last reference.

Page 40: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.40 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Working-set modelWorking-set model

= 10

Page 41: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.41 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

WSSi (working-set size of Process Pi) =total number 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 = WSSi total demand for frames

If the total demand is greater than the total number of available frames (D > m) Thrashing

The OS monitors the working set of each process and allocates enough frames to provide it with its working-set size. If there are enough extra frames, another process can be initiated.

Policy: if D > m, then suspend one of the processes.

Page 42: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.42 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page-Fault Frequency SchemePage-Fault Frequency Scheme

Want to prevent thrashing.

Establish “acceptable” page-fault rate. If actual rate too low, process loses frame.

If actual rate too high, process gains frame.

Page 43: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.43 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

PrepagingPrepaging

In a pure demand-paging system, a large number of page faults occur when a process is started. This situation is a result of trying to get the initial locality into memory.

The same situation may arise at other times. For instance, when a swapped-out process is restarted, all its pages are on the disk and each must be brought in by its own page fault.

Prepaging is the strategy to bring into memory at one time all the pages that will be needed.

Prepaging attempts to prevent the high level of initial paging.

Page 44: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.44 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Page SizePage Size

Page size selection considerations: to minimize internal fragmentation => small page size

to minimize the size of page table => large page size

to minimize I/O time => large page size

to reduce I/O overhead and wasted allocated memory => small page size

to minimize the number of page faults => large page size

The trend is toward larger page size. This is the result of CPU speeds and main memory capacity increasing faster than disk speeds. Pentium II allows page sizes to be either 4K or 4M bytes.

Page 45: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.45 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Other ConsiderationsOther Considerations

Program structure int A[ ][ ] = new int[1024][1024];

Assume that page size is 1024 words

Each row is stored in one page

Program 1 for (j = 0; j < A.length; j++)for (i = 0; i < A.length; i++)

A[i][j] = 1;1024 x 1024 page faults

Program 2 for (i = 0; i < A.length; i++)for (j = 0; j < A.length; j++)

A[i][j] = 1;

1024 page faults

Page 46: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.46 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Other ConsiderationsOther Considerations

I/O Interlock – Pages must sometimes be locked into memory.

Consider I/O. Pages that are used for copying a file from a device must be locked from being selected for eviction by a page replacement algorithm.

Page 47: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.47 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

Real-Time ProcessingReal-Time Processing

Real-time processes expect to gain control of the CPU, and to run to completion with a minimum of delays.

Virtual memory is against real-time computing, because it can introduce unexpected, long-term delays in the execution of a process while pages are brought into memory.

Therefore, real-time systems almost never have virtual memory.

Page 48: 9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation

9.48 Silberschatz, Galvin and Gagne ©2003Operating System Concepts

OS Example: Windows NTOS Example: Windows NT

Uses demand paging with clustering. Clustering brings in pages surrounding the faulting page.

Processes are assigned working set minimum and working set maximum.

Working set minimum is the minimum number of pages the process is guaranteed to have in memory.

A process may be assigned as many pages up to its working set maximum.

When the amount of free memory in the system falls below a threshold, automatic working set trimming is performed to restore the amount of free memory.

Working set trimming removes pages from processes that have pages in excess of their working set minimum.