Memory Management in Representative Operating Systems - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Memory Management in Representative Operating Systems

Description:

... data table used for page replacement. Lists are created within table using pointers ... Strategy: try to maintain a pool of locally free blocks and only invoke ... – PowerPoint PPT presentation

Number of Views:74
Avg rating:3.0/5.0
Slides: 15
Provided by: patt200
Learn more at: http://www.cs.iit.edu
Category:

less

Transcript and Presenter's Notes

Title: Memory Management in Representative Operating Systems


1
Memory Management in Representative Operating
Systems

2
Memory Management and Virtual Memory
  • Memory management requirements
  • Memory partitioning
  • Paging
  • Segmentation
  • Virtual memory with
  • Paging
  • Segmentation
  • Combined paging and segmentation
  • Virtual memory management policies and strategies

3
UNIX and Solaris Memory Management
  • Evolution
  • Early implementations of UNIX used variable
    partitioning and no virtual memory
  • Current implementations SVR4 and Solaris use
    paged virtual memory
  • Memory management schemes in SVR4 and Solaris
  • Paging system
  • Allocates page frames in main memory to processes
  • Allocates page frames to disk block buffers
  • Kernel memory allocator

4
UNIX and Solaris Memory Management (cont.)
  • Paging system
  • Data structures
  • Page table
  • One page table per process
  • One entry for each page in virtual memory for
    that process
  • Disk block descriptor
  • Has an entry associated with each page of a
    process
  • Each entry describes the disk copy of the virtual
    page
  • Page frame data table
  • Describes each frame of real memory
  • Indexed by frame number
  • Swap-use table
  • One table for each swap device
  • One entry for each page on the device

5
UNIX and Solaris Memory Management (cont.)

6
UNIX and Solaris Memory Management (cont.)
7
UNIX and Solaris Memory Management (cont.)
  • Paging system
  • Page replacement
  • Page frame data table used for page replacement
  • Lists are created within table using pointers
    (e.g., list of free frames available when number
    of frames on this table drops below a threshold,
    the kernel will steal a number of pages to
    compensate)
  • Page replacement algorithm in SVR4 is a modified
    clock policy algorithm, the two-handed clock
    algorithm
  • It uses the reference bit in the page table entry
    for each page in memory that is eligible (not
    locked) to be swapped out
  • Bit is set to 0 when page is first brought in and
    set to 1 when page is referenced for read or
    write
  • The front-hand of the algorithm sweeps through
    the eligible pages and sets reference bits to 1
  • The backhand, later, sweeps same list and checks
    the referenced bit if 0, page is placed on the
    list to be paged out
  • Parameters Scanrate and Handspead

8
UNIX and Solaris Memory Management (cont.)
  • Kernel memory allocator
  • Requirement
  • Kernel generates and destroys frequently small
    tables and buffers (e.g, file descriptor blocks)
    which require dynamic memory allocation
  • These tables and buffers are much smaller than
    typical machine page size paging mechanism would
    be inefficient
  • Solution SVR4 uses the lazy buddy system
  • Observation demand for blocks of particular size
    varies slowly in time
  • Solution defer coalescing blocks until it seems
    likely that it is needed and then coalesce as
    many blocks as possible
  • Strategy try to maintain a pool of locally free
    blocks and only invoke coalescing if the number
    of free blocks exceeds a threshold
  • Criterion for coalescing the number of locally
    free blocks of a given size should not exceed the
    number of allocated blocks of that size

9
Linux Memory Management
  • Characteristics
  • Shares many characteristics from the other UNIX
    implementations
  • Has some unique features and is quite complex
  • Linux virtual memory
  • Virtual memory addressing
  • Three-level page table structure
  • Page directory one per active process, size of
    one page
  • Page middle directory
  • Page table
  • Virtual address space has four fields
  • Index into the page directory
  • Index into the page middle directory
  • Index into the page table
  • Offset within the selected page of memory
  • Page table structure is platform independent and
    was designed to accommodate the 64-bi Alpha
    processor

10
Linux Memory Management (cont.)
  • Linux virtual memory (cont.)
  • Virtual memory addressing (cont.)
  • Page allocation
  • A buddy system is used to improve the efficiency
    of reading and writing contiguous blocks of pages
    mapped into contiguous blocks of page frames
  • Kernel maintains a list of contiguous page frame
    groups of fixed size 1, 2, 4, 8, 16, 32 page
    frames
  • For allocation and deallocation of pages in main
    memory, the available groups are split and merged
    using the buddy system
  • Page replacement algorithm
  • Variation of the clock algorithm least
    frequently used policy
  • The use bit is replaced with an 8-bit age
    variable
  • Age variable incremented each time page is
    accessed
  • Periodically, Linux sweeps through the global
    page pool and decrements the age variable for
    each page
  • A page with a low age variable is a candidate for
    replacement

11
Linux Memory Management (cont.)
  • Kernel memory allocation
  • Based on the page allocation mechanism used for
    virtual memory management
  • Buddy algorithm is used to allocate and
    de-allocate kernel memory in units of one or more
    pages
  • Since the kernel needs small (smaller than a
    page) chunks of memory for short intervals,Linux
    uses slab allocation within an allocated page
  • Example on a Pentium/x86 machine page size is 4
    Kbytes and chunks can be allocated in sizes 32,
    64, 128, 252, 508, 2040, and 4080 bytes
  • Slab allocator implementation
  • A set of linked lists are maintained, one for
    each size of chunk
  • Chunks can be split, aggregated, and moved
    between lists like in the buddy algorithm

12
Windows 2000 Memory Management
  • Characteristics
  • Designed to operate over a variety of platforms
    and use page sizes from 4 Kbytes to 64 Kbytes
  • Current platforms
  • Intel, PowerPC, and MIPS platforms have 4,096
    bytes per page
  • DEC Alpha platforms have 8,192 bytes per page
  • W2K virtual address map
  • 2 Gbytes of available virtual address space for
    user (increased optionally to 3 Gbytes)
  • 2 Gbytes for the operating system (W2K Executive,
    microkernel, and device drivers)

13
Windows 2000 Memory Management (cont)
14
Windows 2000 Memory Management (cont.)
  • W2K paging
  • When a process is created, it can use up to 2
    Gbytes (minus 128 Kbytes) of virtual space,
    divided in fixed-size pages
  • Page states
  • Available Pages not currently used by the
    process
  • Reserved Set of contiguous pages set aside for
    the process, but not counted as part of process
    quota until used. Committed to to process when it
    needs to write into memory
  • Committed Pages for which space on the paging
    file has been set aside (e.g., the disk file used
    when removing pages from memory)
  • Resident set management scheme
  • Variable allocation, local scope
  • When process first activated, given a default
    working set if process references a page not in
    memory, one of the resident pages is swapped out
  • Working set of active processes is adjusted as
    follows
  • When memory plentiful, active processes are
    allowed to grow
  • When memory becomes scarce, resident sets for
    each process are reduced
Write a Comment
User Comments (0)
About PowerShow.com