Ejemplo n.º 1
0
// Project Entry Point
// main
// no parameters taken
// expects input via STDIN (redirect or direct entry)
//  input shall conform to 3 integers per line, spaced with whitespace
void main()
{
	ProcessTable pTable;
	initializeTable(&pTable);
	
	//int j;
	//for (j=0; j<pTable.size; j++)
	//	printf("PID: %d\n", pTable.pid[j]);
	
	// do fcfs
	FirstCome(pTable);
	// do shortest job
	ShortestJob(pTable);
	// do shortest remaining job
	ShortestRemaining(pTable);
	// do round robin
	RoundRobin(pTable, 0);
	RoundRobin(pTable, 0.4);
}
Ejemplo n.º 2
0
int main()
{
	char input[MAX_INPUT_LEN];
	int arrPid[MAX_INPUT_LEN];
	int arrArrival[MAX_INPUT_LEN];
	int arrService[MAX_INPUT_LEN];

	// Read data from stdin
	while(fgets(input, MAX_INPUT_LEN, stdin) != 0)
	{
		InputToArray(input, arrPid, arrArrival, arrService);
	}
	// Call function to print the 3 arrays
	FirstCome(arrPid, arrArrival, arrService, _pidIndex);
	ShortestJobFirst( arrPid, arrArrival, arrService, _pidIndex );
	ShortestNext(arrPid, arrArrival, arrService, _pidIndex);
	RoundRobin( arrPid, arrArrival, arrService, _pidIndex );
	return 0;
}