Docsity

Computer Science lecture: Virtual Memory Primitives for User Programs | CS 4210, Slides of Operating Systems

Partial preview of the text

Download Computer Science lecture: Virtual Memory Primitives for User Programs | CS 4210 and more Slides Operating Systems in PDF only on Docsity!

Virtual Memory Primitives for

User Programs

Andrew Appel and Kai Li

Objectives

  • User programs can benefit from use of VM

primitives– Efficiency is important, not dominated by disk

access overhead

  • Many examples
    • What’s the performance on set of OS/arch• Some design considerations

Example: Concurrent Garbage

Collection

-^

From-space and to-space

-^

Traverse reachable objects and move from from-spaceto to-space; eventually discard from-space

-^

ProtN from-space and initiate gc (collector)

-^

Do not block running threads (mutator)

-^

On mutator Trap – move object and Unprot

-^

Must make sure in same process collector and mutatorhave different privileges – Map

-^

Don’t have to worry about synchronization – taken careby protection restriction

-^

Benefits from small page size

Example: Virtual Shared Memory

  • One writer multiple readers• Trap, Prot1, Unprot – to modify read/write

access to shared pages; to get currentcopy of remote page

  • Map2 – trap handler needs access to page

protected from clients

  • Small page size useful (for false sharing)

Other examples:

•^

Generational garbage collection

-^

Persistent stores

-^

Extending addressability

-^

Data-compression paging

-^

Heap overflow detection

How did real systems perform

Design Considerations

-^

Make pages more accessible one at a time, lessaccessible in batches (ProtN)–^

TLB flushes on multi-processors

-^

Page size – small?

-^

Map2:–^

Alternatives: system call to copy to-from protected area (3x),put service in different process, put service in kernel -> notgood…

-^

Map2 with physically addressed caches – ok

-^

Virtually addressed: consistency challenge

-^

Pipelining:–^

Can you undo instruction effects after page fault

-^

Most of the examples are semi-synchronous, so ok.