All pastes #168307 Raw Edit

RAWR

public text v1 · immutable
·published 2006-09-12 21:39 UTC
rendered paste body
int ioComplete(int device)
{
  /*** INSERT YOUR CODE HERE ***/

 int pid;
 
	if(iowaitList[device].count > 0)
	{
		pid = serveList(&iowaitList[device]);
		insertList(&readyList, pid, priorityFunctionPtr);
		pcb[pid].state = state_ready;
		
		fprintf(stdout, "%d: process %d I/O complete on device %d\n", now, pid, device);
	
		if(running == -1)
		{
			dispatching();
		}
		else if(preemptive &&compare_burstlength(pid,running))
		{
			insertList(&readyList,running,priorityFunctionPtr);
			fprintf(stdout, "%d: process %d pre-empted\n", now, running);
			running = -1;
			dispatching();
		
		}
	}
  
  
  return 1;
}