-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor3.cpp
More file actions
18 lines (16 loc) · 906 Bytes
/
processor3.cpp
File metadata and controls
18 lines (16 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//Daniel Kantor & Derek Levine
#include "processor3.h"
#include "struct.h"
data processor3(long speed3, long sTime, int processID, long serviceTime){
if(sTime > speed3 * 1000000000){//if the service time of the process is greater than 1 billion * speed (simulating speed of CPU which is 1 billion * #GHz) then it subtracts 1 billion * speed
sTime = sTime - (speed3 * 1000000000);
cout << sTime << ":Processor 3";
cout << " Process ID: " << processID << "\n";
return data(speed3, sTime, processID,serviceTime);//returns the remaining service time left
}
else{
cout << 0 << ":Processor 3"; //if service time of the process is less than 1 billion * speed then the service time left will be 0, so it returns 0 and the process is done.
cout << " Process ID: " << processID << "\n";
return data(speed3, 0, processID, serviceTime);
}
}