Help with Event Simulation Program

GitHub URL: github.com/CIS-3207/project-1-fall21-tui92851

File: lab1.cpp
can be found in .github folder
---------------


I'm having issues when going through the events and for some reason my second event in the queue goes to job number 528 after an iteration.

What is supposed to happen is its supposed to go through the events, and then the simulation ends when the time hits 1000 which is set by the config. The outline of the program is included in the github link.

Workflow Example (i should be getting this type of workflow):
0 job 1 CPU ARRIVAL begins work on CPU
21 job 1 CPU FINISHED finished on CPU
21 job 1 CPU FINISHED job quit
21 job 2 CPU ARRIVAL begins work on CPU
50 job 2 CPU FINISHED finished on CPU
50 job 3 CPU ARRIVAL begins work on CPU
50 job 2 DISK1 ARRIVAL added to disk1 queue
50 job 2 DISK1 ARRIVAL begins working on disk1
73 job 3 CPU FINISHED finished on CPU
73 job 4 CPU ARRIVAL begins work on CPU
73 job 3 NETWORK ARRIVAL added to network queue
73 job 3 NETWORK ARRIVAL began working on network
83 job 2 DISK1 FINISHED finished on disk1
----------

This is what the output of the program should be which is written to LOG.txt.

The program starts with two initial events in the priority queue, a 'NEW_JOB' events and a 'SIM_FINISH' event at times respectively 0, 1000.

A new Job event will push a CPU_ARRIVAL to the priority queue, and then create a new JOB with a job number of current job + 1.

From the CPU a job will then go to one of three devices, disk1, disk2, or network. For each of these the priority queue must be updated with the event, and outputted to the log file.
Last edited on
If you debug and go line by line in the while loop you get an idea of where the variables get thrown off, not sure why this is happening.
Topic archived. No new replies allowed.