Skip to content
Snippets Groups Projects
Commit e1a1b26b authored by Elizabeth Baker's avatar Elizabeth Baker
Browse files

Sub proc execution times rounded up.

Still a problem with the remaining time of procs run after para proc finishes.
parent 2aab0d52
Branches
Tags all-code-merged-by-hai-v1
No related merge requests found
......@@ -148,14 +148,15 @@ int main(int argc, char *argv[]) {
int nSubProc = numCPU;
if (quot == 0) nSubProc = rem;
newProcess->subProcsRunning = nSubProc;
int subExTime = 1 + quot + (rem!=0);
// create the sub processes
process *parableProcess = malloc(nSubProc * (sizeof(process)));
for (int i = 0; i < nSubProc; i++) {
parableProcess[i].timeArrived = newProcess->timeArrived;
sprintf(parableProcess[i].processID, "%s.%d", newProcess->processID, i);
// subprocess execution time = overhead (1) + integer-share-of-original-execution-time (quot) +
// one-more-if-there-is-some-remaining (i<rem)
parableProcess[i].executionTime = 1 + quot + (i < rem);
// one-more-if-there-is-some-remaining (i<rem) . NAH don't be smart, just round it up.
parableProcess[i].executionTime = subExTime; // 1 + quot + (i < rem);
parableProcess[i].parallelisable = newProcess->parallelisable;
parableProcess[i].timeCompleted = -1;
parableProcess[i].timeRemaining = parableProcess[i].executionTime;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment