Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this project you will create a C + + library that has a class SimOS. Your library should contain a header file SimOS.h that
For this project you will create a C library that has a class SimOS. Your library should contain a header file SimOS.h that I will include in the test driver. Number and names of other files are up to you, but they should follow reasonable programming practices.Your submission should not have function main But you will surely need it while working on the assignment.All the specifications in this assignment should be followed exactly as given. Even small discrepancies will make your project fail with the test driver and will result in points!Create a test driver file with function main and place it in folder with your library. Then build it It should compile, run, and show correct output. On Linux lab, the compilation command will be exactly:gstdccppo runmePay attention, the whole assignment deals with simulation. There is no real CPU and memory management. You can do the whole thing with the tools you learned in CSCI OS simulation:CPU scheduling is prioritybased. Every process has a priority number. The higher is the number, the higher is priority. The process with higher priority uses the CPU. The scheduling is preemptive. It means that if a process with the higher priority arrives to the readyqueue while a lowerpriority process uses the CPU, the lowerpriority process is preempted that is moved back to readyqueue while the higher priority process immediately starts using the CPU. Pay attention, higherpriority process never waits in the readyqueue while lowerpriority process uses the CPU.If there are two or more processes with the same highest priority in the readyqueue, your system can schedule any of them to the CPU.Memory management uses contiguous memory allocation with the bestfit approach. The description of best fit contiguous memory allocation will be given in class and is also available in our textbook.I can ask your library to simulate large amounts of memory say GB or even more C datatype unsigned long long should be able to store such numbers.It is not allowed to represent each byte of memory individually. For example, it is not allowed to use vector with elements to represent bytes of memory.When multiple memory holes simultaneously satisfy best fit condition, use the first one the one with the smallest memory addressDisk management is firstcomefirstserved In other words, all disk IOqueues are real queues FIFOUse the following code:struct FileReadRequestint PID;std::string fileName;;struct MemoryItemunsigned long long itemAddress;unsigned long long itemSize;int PID; PID of the process using this chunk of memory;using MemoryUsage std::vectorMemoryItem;Create a class SimOS. The following methods should be in it: SimOS int numberOfDisks, unsigned long long amountOfRAM
The parameters specify number of hard disks in the simulated computer and amount of memory.
Disks enumeration starts from bool NewProcess int priority, unsigned long long size
Creates a new process with the specified priority in the simulated system. The new process takes place in the readyqueue or immediately starts using the CPU.
Every process in the simulated system has a PID. Your simulation assigns PIDs to new processes starting from and increments it by one for each new process. Do not reuse PIDs of the terminated processes.
For example, the command NewProcess means that a new process with priority level should be created and it requires bytes of memory.
NewProcess returns true if a new process was successfully created and false if otherwise. One of the reasons a process wasnt created is insufficient free memory in the system.bool SimFork
The currently running process forks a child. The child's priority and size are inherited from the parent. The child is placed in the end of the readyqueue.
SimFork returns true if a new process was successfully created and false if otherwise. One of the reasons a process wasnt created is insufficient free memory in the system. void SimExit
The process that is currently using the CPU. Make sure you release the memory used by this process immediately. If its parent is already waiting, the process terminates immediately and the parent becomes runnable goes to the readyqueue or CPU
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started