Gabbell / MemoryManagementUnit

MMU with FIFO Scheduler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MMU

COEN346 - Operating Systems - Assignment 3 - MMU

Memory Management Unit with FIFO Scheduler

Requirements

In this assignment, a Memory Management Unit (MMU) will be created working along a CPU FIFO scheduler. The scheduler can have two processes running in parallel (two cores). The MMU has two types of memory. One is the main memory (RAM) and the other one is the disk memory (virtual memory). The main memory has a fixed size and is made of frames into which pages are put. A page is made of a variable id, a value and an age counter. The main operations of the MMU are “store”, “release” and “lookup”. The store method stores a given page into main memory. If the main memory is full, it will swap out the page which has been there the longest and put it into disk memory. The release method frees the memory linked to the variable id by deleting its page. Lookup will try to access a value linked to a given variable id in the main memory. If the page is not present in main memory, it will try to find it in disk memory. If it does find it, it will swap the linked page into main memory replacing the oldest page. If it does not find the variable id anywhere, the method returns -1.The age of a page is updated every 100 ms. The fixed memory size is read from memconfig.txt, the PCBs from processes.txt and the memory commands from commands.txt.

Results

The program was completed without many issues but some simplifications were made. Because the assignment required two cores to be simulated A new simpler FIFO scheduler was written from scratch to replace the previous version. This made the rest of the assignment much easier. Since the scheduler, the processes, and the MMU had to communicate with each other across different threads, global variables were used as shared memory. Although this is usually considered poor object oriented design (unless you are working with a system where performance is critical), it was satisfactory for the assignment since the program was small. Furthermore, there were some issues during development related to file I/O. Because the MMU simulated page swapping to a permanent storage with a text file on the user’s computer, special care had to be taken when manipulating this file specifically. Entries in the file needed to be accessed and deleted in a random fashion so the contents of the whole file had to be read and rewritten when required. Moreover, the file containing the output log had to be synchronized using a mutex since many different threads could be attempting to write to it at the same time. After dealing with all these concerns, the assignment was completed without much difficulty.

About

MMU with FIFO Scheduler


Languages

Language:C++ 100.0%