I am a newbie that is currently working on a project to evaluate different operating systems algorithms.
I have a class called Process that holds all the data for the process. I began to write my own Linked List for the processes to make linked list of processes but ran into a problem when trying to remove the bottom Process of one list Ready Queue), run it in my CPU function, then add it to another list (Input/Output Queue). So I decided to use the STL list class instead.
I am able to create a linked list of processes using the STL list and access the data inside the processes. But, I need to further work with the lists. Here is my goal:
-Fill ready queue with processes
-remove first item from ready queue
-"run" the process in a function until the process' int data value is 0 (this simulates the CPU burst time of the process)
-after it is through in hte CPU function, add that process to the top of hte Ready Queue
-decrement all processes in the Ready Queue for each iteration in hte CPU function
-repeat till all process' times are 0
The only issue I am having is that I do not know how to pass the list of processes to the funtion in order to work on it. I can pass individual processes to the functions using their pointers
I would rather not have a huge main funtion with all of hte iterations in there. I just want to break it up so that it is more manageable.
Some of the basic code:
int main(int argc, char* argv)