Are you trying to simulate the scheduling queues in a computer? You do not say this anywhere in this thread.
Please confirm that following:
There are three resource types that a process can be waiting for: CPU (C), printers (P), and storage devices (D). The user enters the number of resources of each resource type. A process is identified by its process identifier (PID). A process is either waiting for a resource type or being process by a resource. You are using ready_queue(s) for processes waiting for each resource type. Any resource of a resource type can fulfill a process's need. [Or do you want a ready queue for each resource?]
If each resource (not resource type) can support one process at a time, then as cire indicates in the fourth message, you do not need device_queue. Instead you need one process per resource. If true, an array would be a better container for the storing the processes for that resource type.
What is a c1? Is this a process or a resource?
the head of the ready queue should be at the tail of the device queue |
What if the device queue is empty?
I am assuming above that you have a device queue for each resource type. If this is not true, then please correct the above.
when C1 is entered the head of the device queue basically moves back into the head of the ready queue. |
What if the device queue was empty when C1 was entered in to the device queue?
How long does the process stay in the device or device queue? How are you simulating time?
the task is supposed to be completed |
What causes a task (process?) to be completed? How is this simulated?
interrupt supposed to be sent |
An interrupt is sent from what to what?
Have you made a state transition diagram which describes what states a process can be in? It should show all the events which cause the transitions. If this design is solid, then writing the switch statement which implements it is simple.