Part a: Basic Queue
The goal of this assignment is to reinforce your understanding and implementation of queues in C++. Specifically, the assignment is to do
A double-ended queue is a list that allows the addition and removal of entries from either end. One end is arbitrarily called the
front and the other the rear, but the two ends behave identically. Specify, design, and implement a template class for a double-ended queue. Include operations to check if it is empty or full.
For each end, include operations for adding and deleting entries. Implement the double-ended queue as a doubly linked list.
Call your class deque (which is pronounced "deck"). By the way, the C++ Standard Library has a deque class.
You need to have a test program to test your code and your code needs to meet class standards (preconditions, postconditions, etc.).
Part b: An OS CPU/Process Scheduler
Further use the solution (linked-list implementation of the Queue Class) from Part 6a to implement the following ‘Scheduler', a simulated subsystem of an OS.
In this subproject you are charged to design and implement a Ready Queue (RQ) to support a Scheduler subsystem of an OS. The RQ must be designed as a ‘priority' queue, which is governed by the FIFO policy. Write a Scheduler class to manage this queue - scheduling processes from the queue.
Assume that the queue length is unknown from the start when the computer system is booted, or turned on. Processes get enqueued and dequeued depending on their assigned priority numbers, which are randomly generated. The priority order of the queue is always preserved.
The processes are executed on a virtual CPU (object) for a random-execution time when dequeued by the Scheduler from the RQ.
Write a CPU class that has one member function, ‘Execute,' which simply gets called to execute the process.
Write a Process class that generates ‘processes' at random time intervals, and calls the Scheduler object to enqueue the processes.
The entire logic of this virtual CPU's ‘Execute' function is to simply set a time-counter for each process with the random-execution time when it is dequeued/called by the Scheduler object.
Balance the number of processes-generated and processes-executed using the Poisson/exponential distribution functions (as you generate the random numbers). The times to generate process arrivals and scheduling are mutual exclusive, and random.