Skip to content

Instantly share code, notes, and snippets.

@projjal1
Created October 20, 2020 13:19
Show Gist options
  • Save projjal1/dc2292e23b46ec0dd06c65764c063a99 to your computer and use it in GitHub Desktop.
Save projjal1/dc2292e23b46ec0dd06c65764c063a99 to your computer and use it in GitHub Desktop.
FCFS Scheduling in C
#include<stdio.h>
void fcfs(int arr[],int n,int cur_block)
{
//First print the current block
printf("%d ",cur_block);
for(int i=0;i<n;i++)
{
cur_block=arr[i];
printf("%d ",cur_block);
}
}
int main(void)
{
//Array of blocks
int arr[]={98,183,37,122,12,124,65,67};
//Current block
int cur_block=53;
//Size of disk
int n=sizeof(arr)/sizeof(int);
//Display
printf("Order of seek : - \n");
//First print the block
fcfs(arr,n,cur_block);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment