From 4cb089694ac9d6eec17a8785867265cd4c788de2 Mon Sep 17 00:00:00 2001 From: AhmedHamed3699 Date: Fri, 3 May 2024 02:16:09 +0300 Subject: [PATCH] fix: some various bugs --- .vscode/c_cpp_properties.json | 18 ----- .vscode/launch.json | 24 ------ .vscode/settings.json | 59 -------------- code/clk.c | 1 + code/headers.h | 12 ++- code/process.c | 27 ++----- code/process_generator.c | 18 +---- code/processes.txt | 8 +- code/scheduler.c | 143 +++++++++++++--------------------- code/scheduler.log | 18 ++--- code/scheduler.log2 | 12 --- code/scheduler.log3 | 22 ------ code/scheduler.perf | 8 +- code/scheduler.perf2 | 4 - code/scheduler.perf3 | 4 - 15 files changed, 81 insertions(+), 297 deletions(-) delete mode 100644 .vscode/c_cpp_properties.json delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json delete mode 100644 code/scheduler.log2 delete mode 100644 code/scheduler.log3 delete mode 100644 code/scheduler.perf2 delete mode 100644 code/scheduler.perf3 diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index c2098a2..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "linux-gcc-x64", - "includePath": [ - "${workspaceFolder}/**" - ], - "compilerPath": "/usr/bin/gcc", - "cStandard": "${default}", - "cppStandard": "${default}", - "intelliSenseMode": "linux-gcc-x64", - "compilerArgs": [ - "" - ] - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index be04711..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "C/C++ Runner: Debug Session", - "type": "cppdbg", - "request": "launch", - "args": [], - "stopAtEntry": false, - "externalConsole": false, - "cwd": "/home/george/repos/OctopusOS/code", - "program": "/home/george/repos/OctopusOS/code/build/Debug/outDebug", - "MIMode": "gdb", - "miDebuggerPath": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3e5eb95..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "C_Cpp_Runner.cCompilerPath": "gcc", - "C_Cpp_Runner.cppCompilerPath": "g++", - "C_Cpp_Runner.debuggerPath": "gdb", - "C_Cpp_Runner.cStandard": "", - "C_Cpp_Runner.cppStandard": "", - "C_Cpp_Runner.msvcBatchPath": "", - "C_Cpp_Runner.useMsvc": false, - "C_Cpp_Runner.warnings": [ - "-Wall", - "-Wextra", - "-Wpedantic", - "-Wshadow", - "-Wformat=2", - "-Wcast-align", - "-Wconversion", - "-Wsign-conversion", - "-Wnull-dereference" - ], - "C_Cpp_Runner.msvcWarnings": [ - "/W4", - "/permissive-", - "/w14242", - "/w14287", - "/w14296", - "/w14311", - "/w14826", - "/w44062", - "/w44242", - "/w14905", - "/w14906", - "/w14263", - "/w44265", - "/w14928" - ], - "C_Cpp_Runner.enableWarnings": true, - "C_Cpp_Runner.warningsAsError": false, - "C_Cpp_Runner.compilerArgs": [], - "C_Cpp_Runner.linkerArgs": [], - "C_Cpp_Runner.includePaths": [], - "C_Cpp_Runner.includeSearch": [ - "*", - "**/*" - ], - "C_Cpp_Runner.excludeSearch": [ - "**/build", - "**/build/**", - "**/.*", - "**/.*/**", - "**/.vscode", - "**/.vscode/**" - ], - "C_Cpp_Runner.useAddressSanitizer": false, - "C_Cpp_Runner.useUndefinedSanitizer": false, - "C_Cpp_Runner.useLeakSanitizer": false, - "C_Cpp_Runner.showCompilationTime": false, - "C_Cpp_Runner.useLinkTimeOptimization": false, - "C_Cpp_Runner.msvcSecureNoWarnings": false -} \ No newline at end of file diff --git a/code/clk.c b/code/clk.c index 76feea1..e059d53 100644 --- a/code/clk.c +++ b/code/clk.c @@ -20,6 +20,7 @@ void cleanUpClk(int signum) { int main(int argc, char *argv[]) { printf(ANSI_YELLOW "==>CLK: Clock starting\n" ANSI_RESET); signal(SIGINT, cleanUpClk); + signal(SIGTERM, cleanUpClk); int clk = 0; // Create shared memory for one integer variable 4 bytes shmid = shmget(SHKEY, 4, IPC_CREAT | 0644); diff --git a/code/headers.h b/code/headers.h index 3018e30..2cce2eb 100644 --- a/code/headers.h +++ b/code/headers.h @@ -42,8 +42,8 @@ #define SHKEY 300 -#define LOG_FILE "scheduler.log3" -#define PERF_FILE "scheduler.perf3" +#define LOG_FILE "scheduler.log" +#define PERF_FILE "scheduler.perf" //=============================== // ARGUMENTS @@ -97,7 +97,6 @@ void destroyClk(bool terminateAll) { * cleanUp - Make necessary cleaning */ void cleanUp() { - // TODO any other needed clean up destroyClk(true); killpg(getpgrp(), SIGINT); } @@ -140,7 +139,7 @@ void up(int semid) { perror("Error in up operation"); exit(-1); } else if (DEBUG) { - printf("up operation performed sucessfully with semid = %d\n", semid); + printf("up operation performed successfully with semid = %d\n", semid); } } @@ -154,7 +153,7 @@ void down(int semid) { perror("Error in down operation"); exit(-1); } else if (DEBUG) { - printf("Down operation performed sucessfully of semid = %d\n", semid); + printf("Down operation performed successfully of semid = %d\n", semid); } } @@ -166,9 +165,8 @@ int initSchProShm(int pid) { perror("error in creating shared memory\n"); exit(-1); } else if (DEBUG) { - printf("shmadd created sucessfully\n"); + printf("shmadd created successfully\n"); } - fflush(stdout); return shmid; } diff --git a/code/process.c b/code/process.c index c5f440c..03a5728 100644 --- a/code/process.c +++ b/code/process.c @@ -1,6 +1,4 @@ #include "headers.h" -#include "scheduler.h" -#include "structs.h" #include int *shmAdd; @@ -11,7 +9,7 @@ void sigTermHandler(int signum) { perror("Error in detach\n"); } else if (DEBUG) { printf(ANSI_GREEN - "process %d detached from memory sucessfully\n" ANSI_RESET, + "process %d detached from memory successfully\n" ANSI_RESET, getpid()); } @@ -19,46 +17,31 @@ void sigTermHandler(int signum) { perror("error in deleting shared memory"); } - // FIXME: Samy look at these 2 lines - // I added them because process was reaching return 0 and making the exit - // cleanup which kills the clock and so the whole app - // make sure it doesn't affect the process printf(ANSI_GREY "==>process %d: Terminating\n" ANSI_RESET, getpid()); exit(getpid()); } int main(int agrc, char *argv[]) { - fflush(stdout); - - signal(SIGINT, clearResources); signal(SIGTERM, sigTermHandler); - // FIXME: commented those because they kill the clock - // - // if (atexit(cleanUp) != 0) { - // perror("atexit"); - // exit(1); - // } shmid = initSchProShm(getpid()); shmAdd = (int *)shmat(shmid, (void *)0, 0); - fflush(stdout); initClk(); printf(ANSI_TEAL "==>process %d: Started\n" ANSI_RESET, getpid()); - int preTime = getClk(); + int currTime = getClk(); + int preTime = currTime; while (*shmAdd > 0) { - int currTime = getClk(); if (currTime != preTime) { preTime = currTime; - - // printf(ANSI_TEAL "==>process %d: RT = %d \n" ANSI_RESET, getpid(), - // *shmAdd); (*shmAdd)--; } + + currTime = getClk(); } kill(getppid(), SIGUSR1); diff --git a/code/process_generator.c b/code/process_generator.c index 4404b1c..cb93bfc 100644 --- a/code/process_generator.c +++ b/code/process_generator.c @@ -27,10 +27,6 @@ int main(int argc, char *argv[]) { signal(SIGINT, clearResources); signal(SIGTERM, clearResources); - if (atexit(cleanUp) != 0) { - perror("atexit"); - exit(1); - } printBanner(); @@ -48,13 +44,9 @@ int main(int argc, char *argv[]) { sendProcessesToScheduler(processes, msgQID); destroyQueue(processes); - while (wait(NULL) == -1) { - perror("wait"); - exit(1); - } - // TODO: make wait correctly for the scheduler instead of busy waiting forever + wait(NULL); - destroyClk(true); + cleanUp(); } /** @@ -301,10 +293,6 @@ void sendProcessesToScheduler(queue *processes, int msgQID) { while (!empty(processes)) { process = (process_t *)front(processes); currentTime = getClk(); - if (currentTime == lastTime) { - lastTime = currentTime; - continue; - } if (currentTime < process->AT) { lastTime = currentTime; @@ -314,7 +302,7 @@ void sendProcessesToScheduler(queue *processes, int msgQID) { printf(ANSI_PURPLE "=>GEN:Sending process with id: %d, AT: %d, BT: %d, " "priority: %d to scheduler\n" ANSI_RESET, process->id, process->AT, process->BT, process->priority); - // TODO: check this initial values later + process->RT = malloc(sizeof(int) * process->BT); *process->RT = process->BT; process->WT = 0; diff --git a/code/processes.txt b/code/processes.txt index b5befd8..db33906 100644 --- a/code/processes.txt +++ b/code/processes.txt @@ -1,6 +1,4 @@ #id arrival runtime priority -1 0 1 0 -2 1 2 4 -3 2 11 8 -4 13 1 6 -5 14 6 10 \ No newline at end of file +1 3 1 3 +2 3 2 2 +3 3 3 1 diff --git a/code/scheduler.c b/code/scheduler.c index b7481b8..7014b65 100644 --- a/code/scheduler.c +++ b/code/scheduler.c @@ -14,9 +14,7 @@ #include #include -int msgQID; process_t *currentProcess = NULL; - perfStats stats; /** @@ -33,10 +31,6 @@ int main(int argc, char *argv[]) { signal(SIGINT, clearSchResources); signal(SIGTERM, clearSchResources); signal(SIGUSR1, sigUsr1Handler); - if (atexit(cleanUpScheduler) != 0) { - perror("atexit"); - exit(1); - } initClk(); @@ -46,35 +40,14 @@ int main(int argc, char *argv[]) { (int)schedulerType); createLogFile(); - msgQID = gen_msgQID = initSchGenCom(); + gen_msgQID = initSchGenCom(); + schedule(schedulerType, quantem, gen_msgQID); - printf(ANSI_BLUE "==>SCH: Scheduler Finished\n" ANSI_RESET); - - // writePerfFile(); // moved it to the end of schedule() function - - // TODO Initialize Scheduler - // Create Wait queue ?? - // Create log file - // - // TODO Create process when generator tells you it is time - // Setup COM between process and Scheduler (init msgs queue) - // - // TODO Clear After process termination - // Calculate all needed values (till now) - // Remove process from processes Table (Delete its PCB) - // - // TODO Clean everything when Scheduler finishes or if it is killed - // Calculate all needed stats - // create pref file - // kill all living processes and destroy its PCB (is this right?) - // destroy process table - // destroy clk - // Any other clean up + return (0); } -void initPerformanceStats() -{ +void initPerformanceStats() { stats.numFinished = 0; stats.totalWaitingTime = 0; stats.totalWorkingTime = 0; @@ -120,10 +93,12 @@ void schedule(scheduler_type schType, int quantem, int gen_msgQID) { int lastClk = quantemClk; while (1) { currentClk = getClk(); + if (currentClk - quantemClk >= quantem) { quantemClk = currentClk; rQuantem = 0; } + if (currentClk != lastClk) { printf(ANSI_GREY "========================================\n" ANSI_RESET); printf(ANSI_BLUE "==>SCH: Current Clk = %i\n" ANSI_RESET, currentClk); @@ -136,19 +111,25 @@ void schedule(scheduler_type schType, int quantem, int gen_msgQID) { newProcess = NULL; if (processesFlag) { - if (getProcess(&processesFlag, gen_msgQID, &process)) + while (getProcess(&processesFlag, gen_msgQID, &process)) { newProcess = createProcess(&process); + algorithm(&readyQ, newProcess, &rQuantem); + } } + newProcess = NULL; if (!algorithm(&readyQ, newProcess, &rQuantem) && !processesFlag && !currentProcess) break; - if (rQuantem <= 0) + if (rQuantem <= 0) { + quantemClk = currentClk; rQuantem = quantem; + } lastClk = currentClk; } + switch (schType) { case HPF: case SRTN: @@ -160,16 +141,12 @@ void schedule(scheduler_type schType, int quantem, int gen_msgQID) { default: exit(-1); } - printf(ANSI_BLUE "==>SCH: " ANSI_RED ANSI_BOLD - "All processes are done\n" ANSI_RESET); writePerfFile(); + printf(ANSI_BLUE "==>SCH: " ANSI_RED ANSI_BOLD + "Scheduler Finished\n" ANSI_RESET); - // FIXME: If I exit here it's all sunshines and rainbows - // if I got back to main it gets angry - // something about the stack needs to be fixed - // anyway don't remove this exit - exit(0); + cleanUpScheduler(); } void freeQueueData(void *data) { return; } @@ -218,8 +195,10 @@ int HPFScheduling(void **readyQueue, process_t *process, int *rQuantem) { process_t *newScheduledProcess = NULL; (void)rQuantem; - if (process) + if (process) { insertMinHeap(readyQ, process); + return 1; + } if (!currentProcess && !getMin(*readyQ)) return 0; @@ -245,8 +224,10 @@ int SRTNScheduling(void **readyQueue, process_t *process, int *rQuantem) { process_t *newScheduledProcess = NULL; (void)rQuantem; - if (process) + if (process) { insertMinHeap(readyQ, process); + return 1; + } if (!currentProcess && !getMin(*readyQ)) return 0; @@ -263,9 +244,6 @@ int SRTNScheduling(void **readyQueue, process_t *process, int *rQuantem) { contextSwitch(newScheduledProcess); } - // if (!(currentProcess) || currentProcess != (process_t *)getMin(readyQ)) { - // contextSwitch((process_t *)(extractMin(readyQ))); - // } return 1; } @@ -282,16 +260,18 @@ int RRScheduling(void **readyQueue, process_t *process, int *rQuantem) { queue **readyQ = (queue **)readyQueue; process_t *newScheduledProcess = NULL; - if (process) + if (process) { push(*readyQ, process); + return 1; + } if (!(currentProcess) && empty(*readyQ)) return 0; - if (!currentProcess) + if (!currentProcess) { + *rQuantem = -1; contextSwitch((process_t *)pop(*readyQ)); - - if (*rQuantem <= 0) { + } else if (*rQuantem <= 0) { preemptProcess(currentProcess); push(*readyQ, currentProcess); currentProcess = NULL; @@ -402,25 +382,15 @@ process_t *createProcess(process_t *process) { } void contextSwitch(process_t *newProcess) { - if(newProcess){ + if (newProcess) { + currentProcess = newProcess; if (newProcess->state == READY) { startProcess(newProcess); - } - else if (newProcess->state == STOPPED) { + } else if (newProcess->state == STOPPED) { resumeProcess(newProcess); } - - currentProcess = newProcess; } - // TODO Context Switch (print to log file in start and finish) - // When a process finishes (process get SIGTRM) - // When a process gets a signal (SIGKILL, SIGINT, SIGSTP, ...etc) - // The Switch - // Move old process to ready or wait or (clear after, if it has - // terminated) Save PCB if it still exist (set attributes) Schedule new - // Process (We need the algo here) Load PCB (set attributes) Tell the - // process to start } /** @@ -428,18 +398,17 @@ void contextSwitch(process_t *newProcess) { * @process: pointer to process */ void startProcess(process_t *process) { - if(process){ + if (process) { printf(ANSI_BLUE "==>SCH: Starting process with id = %i\n" ANSI_RESET, - process->pid); + process->pid); - kill(process->pid, SIGCONT); process->state = RUNNING; process->WT = getClk() - process->AT; // log this - logger("started", process); + logger("started", process); } } @@ -449,9 +418,9 @@ void startProcess(process_t *process) { * @process: pointer to process */ void preemptProcess(process_t *process) { - if(process){ + if (process) { printf(ANSI_GREY "==>SCH: Preempting process with id = %i\n" ANSI_RESET, - process->pid); + process->pid); if (process->state == RUNNING) { kill(process->pid, SIGSTOP); @@ -468,28 +437,28 @@ void preemptProcess(process_t *process) { * @process: pointer to process */ void resumeProcess(process_t *process) { -if(process){ + if (process) { - printf(ANSI_BLUE "==>SCH: Resuming process with id = %i\n" ANSI_RESET, - process->pid); + printf(ANSI_BLUE "==>SCH: Resuming process with id = %i\n" ANSI_RESET, + process->pid); - if (process->state == STOPPED) { - kill(process->pid, SIGCONT); - process->state = RUNNING; + if (process->state == STOPPED) { + kill(process->pid, SIGCONT); + process->state = RUNNING; - // log this - logger("resumed", process); + // log this + logger("resumed", process); + } } } -} /** * cleanUpScheduler - Make necessary cleaning */ void cleanUpScheduler() { - msgctl(msgQID, IPC_RMID, (struct msqid_ds *)0); + msgctl(initSchGenCom(), IPC_RMID, (struct msqid_ds *)0); + msgctl(initSchProQ(), IPC_RMID, (struct msqid_ds *)0); destroyClk(true); - killpg(getpgrp(), SIGINT); } /** @@ -517,15 +486,10 @@ int initSchProQ() { } void sigUsr1Handler(int signum) { - // TODO: write an appropriate implementation for this function - // detach the scheduler from the sharedmemory of the rem. time - // of this process (the running one) - pid_t killedProcess; int status; + killedProcess = wait(&status); - printf(ANSI_GREY "==>SCH: Process %d terminated\n" ANSI_RESET, killedProcess); - shmctl(initSchProQ(), IPC_RMID, NULL); currentProcess->TA = getClk() - currentProcess->AT; logger("finished", currentProcess); free(currentProcess); @@ -574,7 +538,7 @@ void logger(char *msg, process_t *p) { } void writePerfFile() { - FILE * perfFile = fopen(PERF_FILE, "w"); + FILE *perfFile = fopen(PERF_FILE, "w"); if (perfFile == NULL) { perror("Can't open perf file"); @@ -584,13 +548,14 @@ void writePerfFile() { int finalTime = getClk(); stats.CPU_utilization = 100.0 * stats.totalWorkingTime / finalTime; - stats.avgWTA = (double) stats.totalWTA / stats.numFinished; - stats.avgWaitingTime = (double) stats.totalWaitingTime / stats.numFinished; + stats.avgWTA = (double)stats.totalWTA / stats.numFinished; + stats.avgWaitingTime = (double)stats.totalWaitingTime / stats.numFinished; // calculate STD Deviation of Weighted Turn around time double sumSquaresErr = 0; for (int i = 0; i < stats.numFinished; i++) { - sumSquaresErr += (stats.WTAs[i] - stats.avgWTA) * (stats.WTAs[i] - stats.avgWTA); + sumSquaresErr += + (stats.WTAs[i] - stats.avgWTA) * (stats.WTAs[i] - stats.avgWTA); } stats.stdWTA = sumSquaresErr / stats.numFinished; diff --git a/code/scheduler.log b/code/scheduler.log index 51a8b83..041ec96 100644 --- a/code/scheduler.log +++ b/code/scheduler.log @@ -1,12 +1,6 @@ -At time 1 process 1 started arr 0 total 1 remain 1 wait 1 -At time 2 process 1 finished arr 0 total 1 remain 0 wait 1 TA 2 WTA 2.00 -At time 2 process 2 started arr 1 total 2 remain 2 wait 1 -At time 4 process 2 finished arr 1 total 2 remain 0 wait 1 TA 3 WTA 1.50 -At time 4 process 3 started arr 2 total 11 remain 11 wait 2 -At time 13 process 3 stopped arr 2 total 11 remain 2 wait 2 -At time 13 process 4 started arr 13 total 1 remain 1 wait 0 -At time 14 process 4 finished arr 13 total 1 remain 0 wait 0 TA 1 WTA 1.00 -At time 14 process 3 resumed arr 2 total 11 remain 2 wait 2 -At time 15 process 3 finished arr 2 total 11 remain 0 wait 2 TA 13 WTA 1.18 -At time 15 process 5 started arr 14 total 6 remain 6 wait 1 -At time 21 process 5 finished arr 14 total 6 remain 0 wait 1 TA 7 WTA 1.17 +At time 3 process 3 started arr 3 total 3 remain 3 wait 0 +At time 6 process 3 finished arr 3 total 3 remain 0 wait 0 TA 3 WTA 1.00 +At time 6 process 2 started arr 3 total 2 remain 2 wait 3 +At time 8 process 2 finished arr 3 total 2 remain 0 wait 3 TA 5 WTA 2.50 +At time 8 process 1 started arr 3 total 1 remain 1 wait 5 +At time 9 process 1 finished arr 3 total 1 remain 0 wait 5 TA 6 WTA 6.00 diff --git a/code/scheduler.log2 b/code/scheduler.log2 deleted file mode 100644 index fbe3a03..0000000 --- a/code/scheduler.log2 +++ /dev/null @@ -1,12 +0,0 @@ -At time 1 process 1 started arr 0 total 1 remain 1 wait 1 -At time 2 process 1 finished arr 0 total 1 remain 0 wait 1 TA 2 WTA 2.00 -At time 2 process 2 started arr 1 total 2 remain 2 wait 1 -At time 4 process 2 finished arr 1 total 2 remain 0 wait 1 TA 3 WTA 1.50 -At time 4 process 3 started arr 2 total 11 remain 11 wait 2 -At time 13 process 3 stopped arr 2 total 11 remain 2 wait 2 -At time 13 process 4 started arr 13 total 1 remain 1 wait 0 -At time 14 process 4 finished arr 13 total 1 remain 0 wait 0 TA 1 WTA 1.00 -At time 14 process 3 resumed arr 2 total 11 remain 2 wait 2 -At time 15 process 3 finished arr 2 total 11 remain 0 wait 2 TA 13 WTA 1.18 -At time 15 process 5 started arr 14 total 6 remain 6 wait 1 -At time 21 process 5 finished arr 14 total 6 remain 0 wait 1 TA 7 WTA 1.17 \ No newline at end of file diff --git a/code/scheduler.log3 b/code/scheduler.log3 deleted file mode 100644 index 8b6dead..0000000 --- a/code/scheduler.log3 +++ /dev/null @@ -1,22 +0,0 @@ -At time 1 process 1 started arr 0 total 1 remain 1 wait 1 -At time 2 process 1 finished arr 0 total 1 remain 0 wait 1 TA 2 WTA 2.00 -At time 2 process 2 started arr 1 total 2 remain 2 wait 1 -At time 2 process 2 stopped arr 1 total 2 remain 2 wait 1 -At time 2 process 2 resumed arr 1 total 2 remain 2 wait 1 -At time 4 process 2 finished arr 1 total 2 remain 0 wait 1 TA 3 WTA 1.50 -At time 4 process 3 started arr 2 total 11 remain 11 wait 2 -At time 4 process 3 stopped arr 2 total 11 remain 11 wait 2 -At time 4 process 3 resumed arr 2 total 11 remain 11 wait 2 -At time 6 process 3 stopped arr 2 total 11 remain 9 wait 2 -At time 6 process 3 resumed arr 2 total 11 remain 9 wait 2 -At time 8 process 3 stopped arr 2 total 11 remain 7 wait 2 -At time 8 process 3 resumed arr 2 total 11 remain 7 wait 2 -At time 10 process 3 stopped arr 2 total 11 remain 5 wait 2 -At time 10 process 3 resumed arr 2 total 11 remain 5 wait 2 -At time 12 process 3 stopped arr 2 total 11 remain 3 wait 2 -At time 12 process 3 resumed arr 2 total 11 remain 3 wait 2 -At time 14 process 3 stopped arr 2 total 11 remain 1 wait 2 -At time 14 process 4 started arr 13 total 1 remain 1 wait 1 -At time 15 process 4 finished arr 13 total 1 remain 0 wait 1 TA 2 WTA 2.00 -At time 15 process 5 started arr 14 total 6 remain 6 wait 1 -At time 16 process 5 stopped arr 14 total 6 remain 5 wait 1 diff --git a/code/scheduler.perf b/code/scheduler.perf index 9faf5ae..8f2cdd6 100644 --- a/code/scheduler.perf +++ b/code/scheduler.perf @@ -1,4 +1,4 @@ -CPU utilization = 100.00% -Avg WTA = 1.37 -Avg Waiting = 1.00 -Std WTA = 0.13 +CPU utilization = 66.67% +Avg WTA = 3.17 +Avg Waiting = 2.67 +Std WTA = 4.39 diff --git a/code/scheduler.perf2 b/code/scheduler.perf2 deleted file mode 100644 index 9faf5ae..0000000 --- a/code/scheduler.perf2 +++ /dev/null @@ -1,4 +0,0 @@ -CPU utilization = 100.00% -Avg WTA = 1.37 -Avg Waiting = 1.00 -Std WTA = 0.13 diff --git a/code/scheduler.perf3 b/code/scheduler.perf3 deleted file mode 100644 index 154cda8..0000000 --- a/code/scheduler.perf3 +++ /dev/null @@ -1,4 +0,0 @@ -CPU utilization = 100.00% -Avg WTA = -6.58 -Avg Waiting = -13.00 -Std WTA = 29.34