Posts

Showing posts with the label operating systems

FIFO Page Replacement Algorithm

Exploring FIFO Page Replacement Algorithm in C TheLazyBusyCoder's Blog Welcome to my coding adventures! In this post, we'll explore a C program. FIFO Page Replacement Algorithm in C Check out my YouTube video explaining this code: Watch now #include <stdio.h> int find(int frame[] , int framesize , int cur) { int i; for(i = 0; i

Round Robin Scheduling algorithm in C

Round Robin Algorithm in C TheLazyBusyCoder's Blog Welcome to my coding adventures! In this post, we'll explore a C program. Round Robin - scheduling algorithm in C Check out my YouTube video: Watch now #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct process { int id , at , bt , ct , tat, wt , rt; } process; typedef struct queue { int pro; } queue; queue root[50]; int front = 0; int rare = 0; void push(int id) { root[rare].pro = id; rare++; } int pop() { if(front == rare) return -1; int temp = root[front].pro; front++; return temp; } int isEmpty() { if(front == rare) return 1; return 0; } void sortAT(process pro[], int n) { process temp; for(int i = 0; i pro[j + 1].at) { temp = pro[j]; pro[j] = pro[j + 1]; pro[j + 1] = temp; } } void display(process ...

Exploring Preemptive Priority Algorithm in C

Exploring Preemptive Priority Algorithm in C TheLazyBusyCoder's Blog Welcome to my coding adventures! In this post, we'll explore a C program. Preemptive Priority - scheduling algorithm in C Check out my YouTube video explaining this code: Watch now #include <stdio.h> #include <stdlib.h> typedef struct process { int id, at, bt, ct, wt, tat, rt , p; } process; void sortID(process pro[], int n) { process temp; for (int i = 0; i pro[j + 1].id) { temp = pro[j]; pro[j] = pro[j + 1]; pro[j + 1] = temp; } } void sortP(process pro[], int n) { process temp; for (int i = 0; i pro[j + 1].p) { temp = pro[j]; pro[j] = pro[j + 1]; pro[j + 1] = temp; } } void display(process pro[], int n) { printf("\n\nTABLE:\n"); for (int...

Preemptive Shortest Job First (SJF) - scheduling algorithm in C

Exploring Preemptive SJF Algorithm in C TheLazyBusyCoder's Blog Welcome to my coding adventures! In this post, we'll explore a C program. Preemptive Shortest Job First (SJF) - scheduling algorithm in C Check out my YouTube video explaining this code: Watch now #include <stdio.h> #include <stdlib.h> typedef struct process { int id, at, bt, ct , wt, tat, rt; } process; void display(process pro[], int n) { printf("P AT BT CT TAT WT \n"); for (int i = 0; i 0) { int min = -1; for(i = 0; i 0) { if(min == -1 || proc[i].rt

Non Preemptive SJF scheduling algorithm in C

Non Preemptive SJF scheduling algorithm in C.  This is a working code with output. If you want the explanation for this code, you can view: this video YouTube Link #include <stdio.h> typedef struct process { int id , at , bt ,rt, ct , tat , wt; } process; void display(process proc[] , int n) { int i; printf("\n\nP AT BT CT TAT WT\n"); for(i = 0; i 0) { int min = -1; for(i = 0; i 0) { if(min == -1 || proc[i].rt

FCFS scheduling algorithm in C (Operating Systems)

FCFS scheduling algorithm in C.  Its working code with output If you want explanation, you can view my YouTube video.  Youtube Link #include <stdio.h> #include <stdlib.h> typedef struct process { int id, at, bt, wt, tat, ct; } process; void sort(process pro[], int n) { process temp; for (int i = 0; i pro[j + 1].at) { temp = pro[j]; pro[j] = pro[j+1]; pro[j+1] = temp; } } void display(process pro[], int n) { printf("\n"); for (int i = 0; i