Skip to content

Instantly share code, notes, and snippets.

View Varad-69's full-sized avatar

varad_patil001 Varad-69

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n, head, total_movement = 0;
printf("Enter the number of requests: ");
scanf("%d", &n);
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h> // Included for abs() function
// Sorting function (looks like Bubble Sort)
void sort(int arr[], int n)
{
int i, j, swap;
for (i = 0; i < n - 1; i++)
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h> // Included for abs() function
// Sorting function (looks like Bubble Sort)
void sort(int arr[], int n)
{
int i, j, swap;
for (i = 0; i < n - 1; i++)
@Varad-69
Varad-69 / pipef.c
Last active November 11, 2025 03:35
#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main() {
int pipefds[2];
int returnstatus;
pid_t pid;
char writemessages[2][20] = {"Hi", "Hello"};
char readmessage[20];
#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main()
{
int pipefds[2];
int returnstatus;
char writemessages[2][20] = {"Hi", "Hello"};
char readmessage[20];
#include <stdio.h>
int main() {
int frames[10], pages[30], count[10];
int no_frames, n, i, j, pos, min, time = 0, fault = 0;
int flag1, flag2;
printf("Enter number of pages: ");
scanf("%d", &n);
#include <stdio.h>
int main() {
int frames[10], pages[30], temp[10];
int no_frames, n, i, j, k, pos, max, fault = 0;
int flag1, flag2;
printf("Enter number of pages: ");
scanf("%d", &n);
printf("Enter the page reference string: ");
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h> // Adding this for clarity, though it might not have been in the image
int main()
{
int n, frame, fault, flag, k = 0;
printf("Enter the number of pages: ");
scanf("%d", &n);
#include <stdio.h>
int main() {
int n = 5; // Number of processes
int m = 3; // Number of resources
int alloc[5][3] = { {0, 1, 0}, {2, 0, 0}, {3, 0, 2}, {2, 1, 1}, {0, 0, 2} };
int max[5][3] = { {7, 5, 3}, {3, 2, 2}, {9, 0, 2}, {2, 2, 2}, {4, 3, 3} };
int avail[3] = {3, 3, 2};
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
#define BUFFER_SIZE 5
#define MAX_ITEMS 15