Mach

Main Idea

main idea

maintain all VM state in a machine-indep module

treat hardware page tables/TLBs as caches of machine-indp info

From a high-level, how virtual addr space different between Mach and VAX/Unix VAS

can allocate any region

children can inherit regions for sharing(copy-on-write)

memory mapped files

user-level pagers and backing storage (have own choice)

Key Data Structure

- resident page table

- addr maps

- memory objects

- pmap

1) Resident Page Table

Keep track of every physical page

Linked by

Memory object using the page

Allocation queue if not being used

Hash table for fast page fault handling

Used by kernal to maintain state of physical resident pages(dirty bits)

Page size is somewhat H/W dependent, but scalable (power of 2)

Provides fast lookup of physical page on page-fault using bucket hash keyed on MemObject+offset

2) The Memory object

  • Mach's memory abstraction

  • Represents a contiguous block of virtual memory

  • tasks access by mapping object (or portion of) into their addr space

  • contains any resident pages and port for the

-physical memory is not allocated until pages are acessed

-Each object has a designated memory manager(or pager)

3) Address Map

  • first current last

  • could map code segment (inheritance = share) and stack segment (inheritance = copy)

Inheritance

  • After a regular UNIX fork()

    -code segment is shared between parent and child

    -child inherited a copy of data segment of parent

    -copy-on-write: should have two different version, but os is lazy

  • Pages of a mapped file are always shared between parent and child to preserve file sharing semantics

  • Pages in the data segment can either be

    • 'copied' to maintain UNIX fork() semantics

    • shared if we want to create a thread instead of a regular UNIX page

4) Shadow objects(Quiz 4)

  • Copy after a write, shadow object created

  • contains only the modified pages, references original object for remainder

5) pmap

  • purpose

    -module implementing all hardware-dependent VM data and code

    -very little knowledge of Mach data structures

    -essentially acts as a cache of indep. info

Page replacement policy

  • similar to VAX/VMS, requires little hardware support

  • Major change is global FIFO pool replacing resident sets of all programs

    • much easier to tune

    • does not support read-time processes

    • can use external pagers

External Pagers

  • Default Mach page handler also provided (at user-level)

  • if kernel sends pageout 'request' to a user-level pager, it can decide which page to swap out

  • if pager is uncooperative, then default pager will be invoked to perform the necessary pageout.

  • Upside

    • VM 'turning' based on app needs

    • Good for maintaining consistency on multiprocessors

    • Allowed for experience of VM sharing over distributed network

  • Downside

    • Upcalls from kernel

results matching ""

    No results matching ""