Lab4 21522678
Lab4 21522678
Lab4 21522678
ID:21522678
Class: IT007.N23.CNCL.1
OPERATING SYSTEM
LAB 4’S REPORT
SUMMARY
Task Status Page
Section 4.4(FCFS) Done 10
Section 4.5 SJF Done 12
RR Done 13
Self-scrores:
*Note: Export file to PDF and name the file by following format:
LAB X – <Student ID>.pdf
FCFS:
SJF:
RR:
#include <stdio.h>
#include <stdlib.h>
#define MAX 10
int remaining_time[MAX];
int total = 0;
int remain = n;
int flag = 0;
int i;
printf("\nGantt Chart:\n\n");
total += burst_time[i];
remaining_time[i] = burst_time[i];
remaining_time[process] = 0;
flag = 1;
remaining_time[process] -= quantum;
if (flag == 1)
--remain;
flag = 0;
if (process == n - 1)
process = 0;
else
++process;
printf("|");
flag = 0;
printf("\n");
printf("%d\t", i);
flag = 1;
if ((i % total) != 0)
printf("%d", total);
printf("\n\n");
int remaining_time[MAX];
int waiting_time = 0;
int turnaround_time = 0;
int flag = 0;
remaining_time[i] = burst_time[i];
int process = 0;
int time = 0;
int remain = n;
while (remain != 0)
time += remaining_time[process];
remaining_time[process] = 0;
flag = 1;
time += quantum;
remaining_time[process] -= quantum;
if (flag == 1)
--remain;
turnaround_time += time;
flag = 0;
if (process == n - 1)
process = 0;
else
++process;
drawGanttChart(burst_time, n, quantum);
int main(void)
scanf("%d", &n);
scanf("%d%d",&pn[i], &bt[i]);
scanf("%d", &quantum);
printf("\n");
roundRobin(bt,pn, n, quantum);
printf("\n\n");
return 0;