



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Roch; Class: OPERATING SYSTEMS; Subject: Computer Science; University: San Diego State University; Term: Unknown 1989;
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Part I must be done individually. Part II may be done with a pair programmer if desired. As with all assignments in this class, qualitative questions should be answered with grammatically correct sentences.
Due, Monday, May 5 th^ at the beginning of class.
o P1: 0x9 -> 0x0, 0xA -> 0x4, 0x8 -> 0xA o P2: 0x6 -> 0x1, 0x7 -> 0xB, 0x8 -> 0xC, 0x9 -> 0xE o P3: 0x1 -> 0x2, 0x2 -> 0x3.
Create an inverted page table for the above set of processes assuming that there are 0x10000 bytes of RAM.
In this assignment, you will construct a simulation of an N-level page tree. Your program will read a file consisting of memory accesses for a single process, construct the tree, and assign frame indices to each page. Once all of the addresses have been specified, the pages which are in use will be printed in order. You will assume an infinite number of frames are available and need not worry about a page replacement algorithm. See section functionality for details.
A 32 bit logical address space is assumed. The user will indicate how many bits are to be used for each of the page table levels, and a user-specified file containing hexadecimal addresses will be used to construct a page table. Mandatory interfaces and structures:
unsigned int LogicalToPage(unsigned int LogicalAddress, unsigned int Mask, unsigned int Shift) - Given a logical address, apply the given bit mask and shift right by the given number of bits. Returns the page number, and can be used to access the page number of any level by supplying the appropriate parameters. Example: Suppose the level two pages occupied bits 22 through 27, and we wish to extract the second level page number of address 0x3c654321. LogicalToPage(0x3c654321, 0x0FC00000, 22) should return 0x31 (decimal 49).
PAGETABLE – Top level descriptor describing attributes of the N level page table and containing a pointer to the level 0 page structure.
LEVEL – An entry for an arbitrary level, this is the structure (or class) which represents one of the sublevels.
MAP – A structure containing information about the mapping of a page to a frame, used in leaf nodes of the tree.
You are given considerable latitude as to how you choose to design these data structures. A sample data structure and advice on how it might be used is given here.
MAP * PageLookup(PAGETABLE *PageTable, unsigned int LogicalAddress) - Given a page table and a logical address, return the appropriate entry of the page table. You must have an appropriate return value for when the page is not found (e.g. NULL if this is the first time the page has been seen). Note that if you use a different data structure than the one proposed, this may return a different type, but the function name and idea should be the same. Similarly, If PageLookup was a method of the C++ class PAGETABLE, the function signature could change in an expected way: MAP * PAGETABLE::PageLookup(unsigned int LogicalAddress). This advice should be applied to other page table functions as appropriate.
void PageInsert(PAGETABLE *PageTable, unsigned int LogicalAddress, unsigned int Frame) - Used to add new entries to the page table. Frame is the frame index which corresponds to the logical address. If you wish, you may replace void with int or bool and return an error code if unable to allocate memory for the page table. HINT: If you are inserting a page, you do not automatically add nodes, they may already exist at some or all of the levels.
All other interfaces may be developed as you see fit.
Your assignment must be split into multiple files (you may group by functionality) and you must have a Makefile which compiles the program when the user types "make". Typing make in your directory MUST generate an executable file called "pagetable".
The traces were collected from a Pentium II running Windows 2000 and are courtesy of the Brigham Young University Trace Distribution Center. The files byutr.h and
When the address translation is specified, each logical address and the corresponding physical address should be output with one address pair per line. Write the numbers as 8 digit zero padded hexadecimal numbers separated by “ -> ”. As an example: 60f74100 -> 00000100 0041f780 -> 00007780 0041f740 -> 00007740
To output the page table, form the page number for valid pages as if it was a 1 level table. As an example from a 3 level page table, if level 0 is 4 bits, level 1 is 8 bits and level 2 is 4 bits, an entry for level 0 page 0x3, level 1 0xCC, level 2 page D which maps to frame 3 would be: 00003CCD -> 00000003
Test Cases and Output
Turn in summaries from 3 runs:
Answer the following questions:
What to turn in
Pair programmers should turn in a single package containing separately answered questions from Part I and the common items for Part II. You must turn in:
Remember that all assignments are due at the beginning of class, and the policy on late assignments is described in the syllabus.