Hello everyone. Ill just give you a brief description of the problem. I need to generate an application that works on a 2 state Operating System model - the 2 states being Ready state and Running state. In a multi processing system, processes that are being executed are given time slices and once their time slice is up (no matter how much they have been executed) they go and wait for their next turn to come. This scheduling
is mostly done through the round robin method. So putting the above mentioned states in the picture, we have the Ready state which is a normal queue and a Running state which hold the process that is actually being executed by the processor at the moment. After its executed the process goes to the back of the queue and waits for its turn in a simple FIFO practice.
Now onto my problem. Ive implemented the queues through linked lists function and have a created constructors for objects(objects will act as processes in my model instead of actual process themselves). The objects contain within themselves a few values. One thing that I havent added yet to the values is the total execution time duration of the object which will taken as user input. Another input to be taken at the start of the program will be the time slice period which will be uniform for all. So lets say an object has a total time of 20s and the time slice is 2s so the object will require ten passes through the running state to completely execute.
For me to implement the time slicing, I needed to know about timers and timestamps - a subject on which I have zero info. So hence I ask you for help. If somebody can implement the time slicing function and add it is an option in the menu that would be great. For example 'To start multiprogramming press 6' this option would start moving the objects through the imaginary running state and once completed move it back into the ready queue and so on. My code on which I have worked uptil now is attached below. os2 is the main class, pcb is the object class and the linkedlist and queue classes are there to implement the queueing functions.
If any confusions dont hesitate to ask. Since I sort of need this in a hurry hence Ill be checking this forum almost every hour for the next 20 hours atleast. Thanks in advance guys.