Sat, 29 Mar, 2025

    
    My students,

    A student writes, and I am forwarding my answer to everyone since there may be
    others in class who need the clarification.

    A student writes:

    > I'm confused on what exact the layout of VAX VMem is. Is the System Space
    > in VMem or PMem?  What's the system space for? Where are the PTEs for P0
    > and P1 space stored? In the System Space? 
    >
    > Name withheld to protect the student who is at the moment confused.

    My answer:

    The VAX, like all ISAs, specifies a number (usually two) of Virtual Address
    Spaces.  The VAX has three, P0, P1, and System.  Each has 1GB of address
    sapce.  P0 is what we have been calling Process Virtual Space.  It belongs to
    the process and does not require privilege to access its locations.  System
    Virtual Space is the set of addresses each process shares with all the other
    processes, and contains the operating system.  It requires privilege to access
    addresses in System Virtual space. 

    The 3rd Virtual Space is P1 Space, which is mostly used for the User Stack.
    Like P0 Virtual Space, it belongs to the process.

    I mentioned P1 in class, but also told you that other than mentioning it, we
    will ignore it for purposes of 460N.  I did not want to tell you there were
    two virtual address spaces and have you read somewhere there are really three,
    and be confused.  So, for our purposes, we will deal with two virtual address
    spaces, P0 space and System Space. 

    Both Process Virtual Space and System Virtual Space are virtual in the sense
    that they exist on the disk and not in memory UNLESS the operating system copies
    them into Physical Memory.  Since we can only access memory locations if they
    are in Physical Memory, if we try to access one of these virtual addresses and
    it is not in memory, a page fault occurs and the operating system has to bring
    the contents of that virtual location into physical memory.

    To make it easier for the operating sytem to bring the contents of a virtual
    location into physical memory, a virtual address space is partitioned into
    slices called pages, and physical memory is partitioned into slices called
    frames.  Pages and frames are the same size.  One does not need all the pages
    in physical memory at the same time, only the pages that the program is
    accessing now. 

    To access a location, we check the PTE of the virtual page containing that
    location.  The valid bit tells if the page is in physical memory, and
    also which frame of physical memory is housing it.  The valid bit also tells
    if the page is not in physical memory, in which case a page fault occurs
    and control goes to the operating system.  The o/s puts the page in a frame,
    puts the frame number in the PTE and tells the program to try again.  This time
    it works since the o/s has copied the contents of the virtual location from
    the disk to a frame of Physical Memory.

    I hope the above helps.  If not, ask again.

    Good luck with the rest of the course.

    Yale Patt