problems with function

I'm having issues with crdw_terminate() function, the problem is after entering c# and then C#, like if I enter c1
It asks for file name, location, r/w and if w the size.
So then, it says: Process with PID 1 sent to CR/DW 1.

So, I enter C1 again.
So, then it says, Done with process with PID 1 in CD/RW 1.

So, I enter C1 again.
It says, Done with process with PID 1 in CD/RW 1.
But it should say, Cannot signal completion interrupt- this CD/RW's queue is empty.
This repeats everytime I enter C1.
Why is it repeating?

That PID 1 should be free, so c1 can use it again, until PID 1 terminates.




Last edited on
This all looks really confusing...

But I would guess it's the same problem as last time. If you use a queue you cannot remove an arbitrary element. So it make no sense to let the user enter a number (on line 108).

Plus in cdrw_terminate() you don't do anything with cdrw_complete. You just set cdrw_head = &firstvalue;
Oh the cdrw_complete is just so user can be able to use C followed by a number. The user should not be able to enter C# until c# was entered. And the PID # should be able to be used again after C# by c# until it is terminated.

This is what each of the function are supposed to be doing: So the arrival() function generates process at tail of ready queue. The terminate() function removes process at head of ready queue. The The cdrw_arrival() function move head of ready queue to tail of cd/rw queue. And the cdrw_terminate() is supposed to move the head of cd/rw queue to the tail of cd/rw queue.
Last edited on
Any ideas? How can I use a vector to do the same thing?
What if I add this in class PCB as private member?
std :: queue <int*> cdrw_queue;

and I do this?

But after c#, when I keep on entering C#, it just keeps repeating "Done with process with PID # in CD/RW #," but when I enter C# its should keep giving errors, you I enter c# again so I can enter PID1 inCDRW# again.

****cdrw_arrival() is for c# and cdrw_terminate() is for C#****
Last edited on
In order to remove it from the head you need in cdrw_terminate() a line like this:

++(*cdrw_head)
or you are simply call terminate()

But again: What is cdrw_complete good for? It is not used.

If you use std :: queue <int*> cdrw_queue; you don't need cdrw_head and cdrw_tail anymore.

[EDIT]
I have no idea what this c# or C# is supposed to mean
Last edited on
Topic archived. No new replies allowed.