UNIX, Solaris, Windows - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

UNIX, Solaris, Windows

Description:

UNIX is a machine-independent operating system, so some elements of the memory ... its variants, the Windows memory manager is designed to be platform independent. ... – PowerPoint PPT presentation

Number of Views:278
Avg rating:3.0/5.0
Slides: 22
Provided by: weis8
Category:

less

Transcript and Presenter's Notes

Title: UNIX, Solaris, Windows


1
UNIX, Solaris, Windows
  • Memory Management

2
UNIX and Solaris Memory Management
  • UNIX is a machine-independent operating system,
    so some elements of the memory management
    implementation change from one platform to
    another.
  • Page replacement, management of swap space, other
    software elements do not change.

3
UNIX and Solaris
  • UNIX SVR4 and Solaris have two memory management
    schemes
  • The paging system, which manages virtual memory
    and allocates buffers for the disk (I/O and file)
    system. Useful for user level processes
  • Kernel memory allocator, which manages kernel
    space. Dynamic allocation of small (less than a
    page, usually) amounts of memory.

4
Swap Space (A Digression)
  • Data pages, stack and heap pages, other parts of
    address space are either created or changed as
    the program executes.
  • Where to put these pages if they are paged out of
    memory?
  • Answer Swap space may be a dedicated disk.
  • Swap space is usually outside of the normal file
    system, for the sake of efficiency.
  • Code pages may be paged out to swap space as
    well.

5
UNIX and Solaris Paging System Data Structures
  • Page table one per process
  • Disk block descriptor describes the disk copy of
    each virtual page (address, storage type)
  • Page frame data table information about contents
    of each frame in memory (used for page
    replacement).
  • Swap-use table information about swap devices
  • Table 8.5 describes entries in detail.

6
Data Structures - Detail
7
Data Structures - Detail
8
SVR4 Page Replacement
  • Two-handed clock algorithm (fig 8.23)
  • not-used-recently instead of LRU
  • Pages are linked into a circular list using the
    pfdata pointer field of the page frame data
    table. The list has two pointers, which remain a
    certain distance apart
  • Fronthand - clears use (referenced) bits
  • Backhand - checks use bits, if use0 prepare to
    swap page out

9
SVR4 Page Replacement
  • Scanrate - how fast the hands move
  • Faster rate frees pages faster
  • Measured in pages examined/second
  • Handspread - gap between hands
  • Smaller gap frees pages faster
  • Smaller window in which to re-use pages
  • System adjusts values based on current amount of
    free memory (between lotsfree and minfree)

10
UNIX Two-Handed Clock
11
SVR4 Page Replacement
  • The pagedaemon process marks those pages that are
    dirty, and asynchronously writes them to swap
    space.
  • Clean pages are immediately made available.

12
UNIX Kernel Space Management
  • UNIX kernel allocates/destroys many small data
    structures lt one page in size
  • Paging would be inefficient
  • Some versions (SVR4) use a modified buddy system
    approach to manage an area of kernel space that
    is outside the paging system.

13
Linux Memory Management
  • Similar to other UNIX implementations.
  • Three-level page tables
  • Page directory one page in size, always in
    memory. Each entry points to one page of the
    middle level
  • Page middle directory Each entry points to one
    page in the actual page table
  • Page table each entry points to one virtual page
    of a process

14
In general there are several frames (nodes) at
each level of the page table (except in the
directory). Low order addresses are shown at the
bottom of each frame. Loading the cr3 register
flushes the TLB.
15
Linux Page Tables
  • The Linux 3-level page table allowed Linux to run
    on the 64-bit DEC Alpha processor, which
    supported this approach.
  • By making the middle level the same size as the
    directory, this page table structure can also
    work on two-level page table platforms such as
    32-bit Pentium/x86 and later.

16
Page Allocation in Linux
  • To reduce I/O overhead, Linux implements a
    mechanism to read in several contiguous pages at
    one time and store them in a contiguous block of
    memory.
  • It uses the buddy system to allocate free space
    in variable sized page units (2, 4, 8...)
  • The page replacement algorithm is another
    variation of clock.

17
Page Replacement in Linux
  • A variation of the clock algorithm.
  • Instead of the single use bit in the page table
    newest versions of Linux use an 8-bit age
    variable that increments every time the page is
    referenced.
  • This provides more information for page
    replacement than the binary use bit (reference
    bit)
  • The algorithm is a better approximation to LRU
    than simpler versions of clock.

18
Windows Memory Management
  • Like UNIX and its variants, the Windows memory
    manager is designed to be platform independent.
  • Addresses are 32 bits, which yields a 4GB address
    space, divided as follows
  • User address spaces of 2 Gbytes.
  • 2 Gbytes of system space.
  • Page size depends on the underlying hardware.

19
Windows 2000
20
Windows Paging
  • Virtual pages can be in one of three states
  • Available these pages arent being used. Most
    programs wont require the entire 2GB
  • Reserved not in use now, but may be needed soon
    for the stack, dynamic arrays, etc.
  • Committed pages that actually exist in the
    process and have been allocated swap space. In
    Windows, swap space paging file.

21
W2K Resident Set Management
  • Strategy variable allocation, local scope
  • OS allocates a default resident set size
  • When a process reaches its limit, it discards an
    old page before it brings in a new one.
  • If free memory is available, a process is allowed
    to increase its resident set size.
  • If memory is scarce, working sets are reduced by
    moving out pages that havent been used recently.
Write a Comment
User Comments (0)
About PowerShow.com