From e1a1b26bcc984765ded6de363d52159cf5a2d856 Mon Sep 17 00:00:00 2001
From: bakere1 <bakere1@student.unimelb.edu.au>
Date: Mon, 29 Mar 2021 02:05:54 +1100
Subject: [PATCH] Sub proc execution times rounded up. Still a problem with the
 remaining time of procs run after para proc finishes.

---
 allocate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/allocate.c b/allocate.c
index 7b38450..b383ca3 100644
--- a/allocate.c
+++ b/allocate.c
@@ -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;
-- 
GitLab