In this phase we will add the Memory Management layer to our toy OS. We will implement demand-paging. Set page size to 8 words, therefore there are 32 frames in our 256 word memory. Each entry in page

In this phase we will add the Memory Management layer to our toy OS. We will implement demand-paging. Set page size to 8 words, therefore there are 32 frames in our 256 word memory. Each entry in page table consists of the frame number, the valid/invalid-bit, and the modify-bit. We will use two page replacement algorithms, FIFO and LRU. When a page-fault occurs, the offending process is placed in the wait queue with the trap completion time set to 27 clock ticks later–same as I/O operations. After a page fault is serviced, that is 27 or more clock ticks have passed, the process is moved to ready queue. Once a page-fault occurs, you may load the new page into memory immediately. This way when page-fault has been serviced (its time is reached or has passed) the page is already in memory.

In addition to the information gathered in Phase II, for each process compute:

Haven’t Found The Relevant Content? Hire a Subject Expert to Help You With
In this phase we will add the Memory Management layer to our toy OS. We will implement demand-paging. Set page size to 8 words, therefore there are 32 frames in our 256 word memory. Each entry in page
Post Your Own Question And Get A Custom Answer
Hire Writer

Number of Page-faults and Hit Ratio

Hit Ratio is the percentage of non-page fault memory references.

You will need to add a Translation Look-aside Buffer (TLB) to the Virtual Machine (VM). Without a TLB, and assuming a PTBR, every logical memory reference results in two physical memory references and hence a slower system.

Inclusion of TLB is both more realistic and simplifies the OS! If a memory reference is found in TLB it is handled in the hardware/VM and it takes 4 time units; otherwise, it results in a trap to the OS. Every time a new process takes over the VM, it copies its page table content onto the TLB as part of the context switch process.

All logical addresses in a program are translated at run time (by VM) to physical memory addresses through TLB. This includes pc as well. Every time a program refers to a logical address or VM increments pc, VM first compares the address withlimit to make sure an out of bound reference has not occurred, then it computes its equivalent physical address by mapping it through TLB. If the physical address is not found, because the page that contains it is not in memory (it’s invalid), then a page fault results and VM returns. Of course, all of this happens within the VM.

To support LRU, add 32 registers to the VM–one register per frame. These “frame registers” can be represented by a vector of integers. Each time a frame is accessed, the hardware saves the current time in its corresponding register. OS accesses frame registers to perform the LRU page replacement algorithm.

FIFO doesn’t need these frame registers. The OS maintains its own vector of (software) frame registers, and FIFO is entirely done by the OS without hardware help. When a page is brought into memory, the OS records the current time in its corresponding software frame register. The page-fault handling section of OS consults software frame registers to select the victim page.

Run your OS twice, once with LRU and once with FIFO page replacement algorithm for the same set of programs.

$ os -fifo$ os -lru

This way the merits of the two algorithms can be compared. Use seekp() to replace a page in .o file which serves as the simulated disk. Note that you don’t need to replace a page if its corresponding frame has not been modified.

As far as stack is concerned, it takes up as many pages as necessary in high memory. Memory locations taken up by stack will not be available for paging purposes. If the stack grows too large trying to overwrite an allocated frame, that frame has to move out (and replaced on disk if necessary) before the stack can grow any larger.

We will fix degree of multiprogramming at 5; only 5 PCBs are in either ready queue, wait queue, or CPU at the same time. When the OS starts, it assembles 5 .s files to their corresponding .o files, loads in the first page of each .o file into memory, sets up their page tables, sets up their PCBs in ready queue, and starts executing the first process.

As the processes are executed, more pages are brought in based on the availability of frames and requests of the processes. Only when a process exits, a new process is added to the system to maintain a degree of multiprogramming equal to 5. Note that in this phase we need to add “Page Fault” as a new condition for context switch in addition to the conditions in Phase II. We use bit 10 of status register (SR) in conjunction with bits 5-7 to represent page fault. When bits 5-7 are all zeros and bit 10 is 0, we have a time-slice interrupt. When bits 5-7 are all zeros and bit 10 is 1, we have a page fault interrupt. And in case of a page fault, VM uses bits 11 through 15 to let OS know which page to bring in.

Here is the new configuration of SR:

  Page#    PF    I/O Reg    VM Ret Status    V    L    E    G    C    15:11  10      9:8          7:5  4  3  2  1  0

Add four more .s programs: addVector.s, subVector.s, simple1.s, and simple2.s to the list of programs from Phase II for a total of 10 programs. The input files for the vector programs are and

Since the ls command lists files in alphabetical order, the order in which the programs are brought in, as a result of

system(“ls *.s > progs”);

is as follows:

addVector.s fact1.s fact2.s io.s simple1.s simple2.s sub.s subVector.s sum1.s sum2.s

To incrementally develop your OS, first make sure that your program runs correctly for just simple1.s and simple2.s. That is the OS has only the above two programs to run. A quick inspection of theses two programs reveals that each generates only one page fault and 28 frames remain free. This implies there is no need for a page replacement algorithm in this first step. After these two programs run correctly, then try running more programs at the same time.

Demonstrate your program and hand in printouts of your source code and all .out files for each page replacement algorithm. The same grading criteria as Phase I and II holds.

Why Hire a Professional Essay Writer from MyHomeworkGeeks

Quality Urgent Essays

Domyhomeworkk online platform provides the best essay writing service ever received elsewhere, thanks to our professional essay writers. Experience gained in the 10+ years of being in the assignment writing industry is also an added advantage.

Professional and Experienced Academic Writers

A lot is done to maintain us as the best essay writing service provider. Besides owning a degree from a recognized university, a writer must pass the rigorous tests we take them through before they are considered eligible to offer urgent essay help on our website.

Affordable Urgent Assignment Help

Who said a reliable website should not be cheap also? While it is human nature to associate prices with quality, that does not always work. At, we guarantee you cheap and urgent essay help without compromising the quality.

24/7 Available Urgent Essay Writing Service

Whether it is a ‘write my essay for me cheap’ or ‘edit my essay’ order you want to request, always feel free to reach us at any time of the day. Our experts work in shifts to ensure that you access urgent essay writing services at any time of the day.

Plagiarism Free Essays Online

The punitive measures that come with plagiarized content are so harsh, and we understand that. We consequently ensure to write each client’s papers from scratch no matter how urgent the essay is. To acknowledge borrowed content, our quick writer references and cites the work.

Wow Customer Support 24/7

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

So much stress and so little time? Take care of yourself: let us help you with your tasks. We offer all kinds of writing services.


Custom Essay Writing Services

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.


Admission and Business Papers

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.


Editing and Proofreading

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.


Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

Have a homework question? Get help from verified tutors now!