Partial preview of the text
Download Implemenation of scheduling algorithm and more Lab Reports Operating Systems in PDF only on Docsity!
LAB - 6
ROUND ROBIN ALGORITHM
PRIORITY BASED SCHEDULING
LAB -6 ROUND ROBIN ALGORITHM Open + 1 #include 0) { 24 for(i = 0; i< processes; i++) { if(temp_burst[i] > 0) { 26 if(temp_burst[i] > quantum) { 27 time += quantum; 28 temp _burst[i] -= quantum; 29 else { 30 time 4 tame huret lil Cw TabWidth: 8¥ — _Ln55, Col 2 INS PRIORITY BASED SCHEDULING rr Open ¥ . save = x 1 #include tdi 2 3 struct Process { 4 int pid; 5 int burst_time; 6 int priority; 7 int waiting time; 8 int turnaround time; 9}; 10 1l void sort_processes(struct Process p[], int n) { 12 for (int i = 0; i p[j+1].priority) { 15 struct Process temp = p[jl; 16 PLj] = plj+1]; 17 p[j+i] = temp; 18 + 19 t 20 t 21} 22 23 int main() { 24 int n; 25 printf ( umber of esse: 5 26 scanf("%d", &n); 27 28 struct Process p[n]; 29 for (int i = 0; i