Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More bug fixes #22

Merged
merged 6 commits into from
Apr 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
style: change the output format again
amir-kedis committed Apr 30, 2024
commit 8c38ab913bf1fd4e85f3572eb7d2b5d98970bcb5
2 changes: 2 additions & 0 deletions code/process_generator.c
Original file line number Diff line number Diff line change
@@ -315,6 +315,8 @@ void sendProcessesToScheduler(queue *processes, int msgQID) {
"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;
process->TA = 0;
process->LST = currentTime;
9 changes: 5 additions & 4 deletions code/scheduler.c
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ int main(int argc, char *argv[]) {
createLogFile();
msgQID = gen_msgQID = initSchGenCom();
schedule(schedulerType, quantem, gen_msgQID);
printf(ANSI_BLUE "==>SCH: Scheduler Finished\n" ANSI_RESET);

// TODO Initialize Scheduler
// Create Wait queue ??
@@ -130,11 +131,10 @@ void schedule(scheduler_type schType, int quantem, int gen_msgQID) {
if (rQuantem <= 0)
rQuantem = quantem;

if (currentClk != lastClk)
printf(ANSI_GREY "========================================\n" ANSI_RESET);
lastClk = currentClk;
}
printf(ANSI_BLUE "==>SCH: All processes are done\n" ANSI_RESET);
printf(ANSI_BLUE "==>SCH: " ANSI_RED ANSI_BOLD
"All processes are done\n" ANSI_RESET);
}

void freeQueueData(void *data) { return; }
@@ -288,7 +288,8 @@ int getProcess(int *processesFlag, int gen_msgQID, process_t *process) {
}

if (process->id == -1) {
printf(ANSI_BLUE "==>SCH: Received All Processes\n" ANSI_RESET);
printf(ANSI_BLUE "==>SCH: " ANSI_RED ANSI_BOLD
"Received All Processes\n" ANSI_RESET);
*processesFlag = 0;
return 0;
}
9 changes: 0 additions & 9 deletions code/scheduler.log
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
At time 2 process 1 started arr 2 total 20 remain 20 wait 0
At time 5 process 1 stopped arr 2 total 20 remain 17 wait 0
At time 5 process 2 started arr 5 total 10 remain 10 wait 0
At time 15 process 2 finished arr 5 total 10 remain 0 wait 0 TA 0 WTA 0.00
At time 15 process 1 resumed arr 2 total 20 remain 15 wait 13
At time 29 process 1 finished arr 2 total 20 remain 0 wait 13 TA 0 WTA 0.00
At time 29 process 3 started arr 9 total 15 remain 0 wait 20
At time 29 process 3 finished arr 9 total 15 remain 0 wait 20 TA 0 WTA 0.00
At time 29 process 4 started arr 11 total 17 remain 17 wait 18
At time 46 process 4 finished arr 11 total 17 remain 0 wait 18 TA 0 WTA 0.00