Uploaded by Brian Kirui

Suppose you are starting to develop a mini operating system

advertisement
Suppose you are starting to develop a mini operating system. You will need to design many modules for
this. One of them is the memory management unit. With the memory management system, applications
can be moved to memory and processes can be managed in memory. Develop a small memory
management simulation for this. First of all, take a look at the information below.
The information you need to keep for processes is shown below. Accordingly, you will keep Process
Control Block information, which is a unique number (PID) of a process, its location on the disk, the file
name on the disk containing the source of the process, and important information about the process,
which is separate for each process and stored in a different place from the Process Table.
A lot of information about a process is kept. We will only keep this mentioned information. Within the
Process Control Block, the physical memory address used when placing the process in memory, the Base
Address, and the Limit Register, which limits it so that it cannot interfere with the space of other
processes, will be stored in the memory. Thus, the logical memory address information of the process is
provided. The figure representing this is shown below;
We will now have some assumptions for your simulation:
• Our operating system uses the address 0 to 10000.
• The maximum memory address is 100000.
• The limits you will set aside for your processes can only be: 10000, 15000, 20000,
25000, 30000.
• While the processes are placed in the memory, the appropriate memory location will be found
according to the FirstFit (first available place) algorithm and the process will be placed. The FirstFit
algorithm places the process in the first optimal position.
• You will only have two files: one is the header file named m3.h that handles memory management and
the other is the source file named main.cpp. So your program will be started from main.cpp.
• Name of your process creation function: CreateProcess
• Name of your process destruction function: DestroyProcess
• You should do this application using Linked List only. You have to create the Linked List structure
yourself. You cannot use any ready-made library for this.
In the simulation, first create 5 processes with random limits and print them on the screen. If there is an
application that cannot be started due to lack of memory, print these applications on the screen under
the title of applications that cannot be started. Then randomly destroy 2 of these processes and print the
remaining processes on the screen. Then create 5 processes with random limits and print all processes
on the screen. If there is an application that cannot be started due to lack of memory, print these
applications on the screen under the title of applications that cannot be started. Finally, print on the
screen how many seconds all these processes take in total.
Download