Answered step by step
Verified Expert Solution
Link Copied!

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 0 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:g++-std=c++17*.cpp-o 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 23500.OS simulation:CPU scheduling is priority-based. 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 ready-queue while a lower-priority process uses the CPU, the lower-priority process is preempted (that is moved back to ready-queue) while the higher priority process immediately starts using the CPU. Pay attention, higher-priority process never waits in the ready-queue while lower-priority process uses the CPU.If there are two or more processes with the same highest priority in the ready-queue, your system can schedule any of them to the CPU.Memory management uses contiguous memory allocation with the best-fit 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 64 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 1000 elements to represent 1000 bytes of memory.When multiple memory holes simultaneously satisfy best fit condition, use the first one (the one with the smallest memory address).Disk management is first-come-first-served. In other words, all disk I/O-queues are real queues (FIFO).Use the following code:struct FileReadRequest{int PID{0};std::string fileName{""};};struct MemoryItem{unsigned long long itemAddress;unsigned long long itemSize;int PID; // PID of the process using this chunk of memory};using MemoryUsage = std::vector<MemoryItem>;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 0.- 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 ready-queue or immediately starts using the CPU.
Every process in the simulated system has a PID. Your simulation assigns PIDs to new processes starting from 1 and increments it by one for each new process. Do not reuse PIDs of the terminated processes.
For example, the command NewProcess(5,1000) means that a new process with priority level 5 should be created and it requires 1000 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 ready-queue.
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 ready-queue or CPU

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

Did the researcher display conflicts and value differences?

Answered: 1 week ago

Question

write about your research methods.

Answered: 1 week ago