OSFileLess
OSFileLess
Ease of use Easy to use Littly difficult for first Easy to use
time user
Security More prone to attack More vulnerable than Less prone to attacks
Unix but less than
Windows
Gaming More games are Less games are present Less games are present
present.
Development and Developed and Linux is open sourced Most of Unix system are
Distribution distributed by Microsoft and distributed by developed by AT&T with
various vendors other commercial
vendors and non profit
organization.
Disadvantages
● Security Concerns
● Paid software
● Infection assults
● Rebooting a framework
● High Performance System Required
2. LINUX
Advantages
● Open Source
● No antivirus software needed
● Low system specifications
● No reboot needed for installing/uninstalling
● Less disk space needed
3. UNIX
Advantages
● Very stable
● Less code to execute
● Ideal for web hosting
● Safe and secure
● Multitasking
Disadvantages
● Not user friendly
● Cryptic commands
● Gaming
● Less softwares are available
● Software Compatibility
EXPERIMENT 2
EXPERIMENT 3.1
PROGRAM
#include <stdio.h>
int main()
{ int i,n;
printf("p no.= process number\t at=arrival time\t bt=Burst time\t ct=Completion time\t tat=Turn
around time\t wt=waiting time\n");
scanf("%d",&n);
int p[15];
int at[15];
int bt[15];
for(i=1;i<(n+1);i++)
scanf("%d",&at[i]);
for(i=1;i<(n+1);i++)
scanf("%d",&bt[i]);
int ct[15];
ct[0]=0;
for(i=1;i<(n+1);i++)
int tat[15];
for(i=1;i<(n+1);i++)
tat[i]=ct[i]-at[i];
int wt[15];
for(i=1;i<(n+1);i++)
wt[i]=tat[i]-bt[i];
float avgtat,avgwt;
avgtat=0.0;
avgwt=0.0;
for(i=1;i<(n+1);i++)
avgtat=avgtat+tat[i];
for(i=1;i<(n+1);i++)
avgwt=avgwt+wt[i];
avgtat=avgtat/n;
avgwt=avgwt/n;
printf("p no.\tat\tbt\tct\ttat\twt\n");
for(i=1;i<(n+1);i++)
return 0;
OUTPUT
EXPERIMENT 3.2(a)
Aim-: Implement SJF CPU Scheduling:
int main() {
sum_burst_time += burst_time[i];
burst_time[9] = 9999;
smallest = 9;
if (at[i] <= time && burst_time[i] > 0 && burst_time[i] < burst_time[smallest])
smallest = i;
time += burst_time[smallest];
return 0;
OUTPUT
EXPERIMENT 3.2(b)
Aim-: Implement SJF CPU Scheduling:
int main()
int a[10],b[10],x[10],i,j,smallest,count=0,time,n;
double avg=0,tt=0,end;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
scanf("%d",&b[i]);
for(i=0;i<n;i++)
x[i]=b[i];
b[9]=9999;
for(time=0;count!=n;time++)
smallest=9;
for(i=0;i<n;i++)
b[smallest]--;
if(b[smallest]==0)
count++;
end=time+1;
avg=avg+end-a[smallest]-x[smallest];
tt= tt+end-a[smallest];
return 0;
OUTPUT
EXPERIMENT 3.3(a)
Aim-: Implement PRIORITY CPU Scheduling:
int temp=*a;
*a=*b;
*b=temp;
int main()
int n;
scanf("%d",&n);
int burst[n],priority[n],index[n];
for(int i=0;i<n;i++)
printf("Enter Burst Time and Priority Value for Process %d: ",i+1);
scanf("%d %d",&burst[i],&priority[i]);
index[i]=i+1;
for(int i=0;i<n;i++)
int temp=priority[i],m=i;
for(int j=i;j<n;j++)
m=j;
swap(&priority[i], &priority[m]);
swap(&burst[i], &burst[m]);
swap(&index[i],&index[m]);
int t=0;
for(int i=0;i<n;i++)
t+=burst[i];
printf("\n");
int wait_time=0;
int total_wait_time = 0;
for(int i=0;i<n;i++)
printf("P%d\t\t%d\t\t%d\n",index[i],burst[i],wait_time);
total_wait_time += wait_time;
wait_time += burst[i];
total_Turn_Around += burst[i];
return 0;
OUTPUT
EXPERIMENT 3.3(b)
Aim-: Implement PRIORITY CPU Scheduling:
struct process
int WT,AT,BT,TAT,PT;
};
int main()
int n,temp[10],t,count=0,short_p;
float total_WT=0,total_TAT=0,Avg_WT,Avg_TAT;
scanf("%d",&n);
printf("Enter the arrival time , burst time and priority of the process\n");
printf("AT BT PT\n");
for(int i=0;i<n;i++)
scanf("%d%d%d",&a[i].AT,&a[i].BT,&a[i].PT);
temp[i]=a[i].BT;
a[9].PT=10000;
for(t=0;count!=n;t++)
short_p=9;
for(int i=0;i<n;i++)
short_p=i;
a[short_p].BT=a[short_p].BT-1;
if(a[short_p].BT==0)
// so count increases by 1
count++;
a[short_p].WT=t+1-a[short_p].AT-temp[short_p];
a[short_p].TAT=t+1-a[short_p].AT;
// total calculation
total_WT=total_WT+a[short_p].WT;
total_TAT=total_TAT+a[short_p].TAT;
Avg_WT=total_WT/n;
printf("ID WT TAT\n");
for(int i=0;i<n;i++)
printf("%d %d\t%d\n",i+1,a[i].WT,a[i].TAT);
return 0;
OUTPUT
EXPERIMENT 3.4
Aim-: Implement ROUND ROBIN CPU Scheduling:
int main()
scanf("%d", &limit);
x = limit;
printf("Arrival Time:\t");
scanf("%d", &arrival_time[i]);
printf("Burst Time:\t");
scanf("%d", &burst_time[i]);
temp[i] = burst_time[i];
for(total = 0, i = 0; x != 0;)
temp[i] = 0;
counter = 1;
x--;
counter = 0;
if(i == limit - 1)
i = 0;
i++;
else
i = 0;
return 0;
OUTPUT
#define MAX_PROCESSES 10
#define MAX_RESOURCES 10
int main() {
int available[MAX_RESOURCES];
int max_claim[MAX_PROCESSES][MAX_RESOURCES];
int allocation[MAX_PROCESSES][MAX_RESOURCES];
int need[MAX_PROCESSES][MAX_RESOURCES];
int work[MAX_RESOURCES];
int finish[MAX_PROCESSES];
int safe_sequence[MAX_PROCESSES];
int i, j, k;
scanf("%d", &num_processes);
scanf("%d", &num_resources);
scanf("%d", &available[i]);
scanf("%d", &max_claim[i][j]);
scanf("%d", &allocation[i][j]);
finish[i] = 0;
work[i] = available[i];
int count = 0;
int found = 0;
if (!finish[i])
int j;
break;
if (j == num_resources)
work[k] += allocation[i][k];
safe_sequence[count] = i;
finish[i] = 1;
found = 1;
count++;
if (!found)
return 0;
printf("P%d ",safe_sequence[i]);
printf("\n");
return 0;
OUTPUT
EXPERIMENT 5
Aim-: Implementation of resource allocation graph(RAG).
for(i=0;i<m;i++)
for(j=0;j<m;j++) scanf("%d",&request[i][j]);
avail[j]=r[j];
for(i=0;i<n;i++)
avail[j]-=alloc[i][j];
for(i=0;i<n;i++)
if(alloc[i][j]==0) count++;
else break;
if(count==m) mark[i]=1;
for(j=0;j<m;j++)
if(request[i][j]<=w[j]) canbeprocessed=1;
else
canbeprocessed=0; break;
if(canbeprocessed)
if(deadlock)
OUTPUT
EXPERIMENT 6.1
Aim-: Implementation of contiguous allocation techniques.
1. WORST FIT
struct Block
int size;
int allocated;
};
void allocateMemory(struct Block blocks[], int numBlocks, int processSizes[], int numProcesses)
int i, j, worstFitIndex;
worstFitIndex = -1;
worstFitIndex = j;
if (worstFitIndex == -1) {
printf("Memory allocation failed for process %d. No suitable block found.\n", i + 1);
} else {
blocks[worstFitIndex].allocated = 1;
int main() {
scanf("%d", &numBlocks);
scanf("%d", &blocks[i].size);
blocks[i].allocated = 0;
scanf("%d", &numProcesses);
scanf("%d", &processSizes[i]);
return 0;
OUTPUT
EXPERIMENT 6.2
Aim-: Implementation of contiguous allocation techniques.
PROGRAM
#include <stdio.h>
struct Block
int size;
int allocated;
};
void allocateMemory(struct Block blocks[], int numBlocks, int processSizes[], int numProcesses)
int i, j, bestFitIndex;
bestFitIndex = -1;
bestFitIndex = j;
if (bestFitIndex == -1)
printf("Memory allocation failed for process %d. No suitable block found.\n", i + 1);
} else
blocks[bestFitIndex].allocated = 1;
int main()
scanf("%d", &numBlocks);
scanf("%d", &blocks[i].size);
blocks[i].allocated = 0;
scanf("%d", &numProcesses);
int processSizes[MAX_PROCESSES];
scanf("%d", &processSizes[i]);
return 0;
PROGRAM
#include <stdio.h>
struct Block
int size;
int allocated;
};
void allocateMemory(struct Block blocks[], int numBlocks, int processSizes[], int numProcesses)
int i, j;
blocks[j].allocated = 1;
printf("Memory allocated successfully for process %d. Block size: %d\n", i + 1, blocks[j].size);
break;
if (j == numBlocks)
printf("Memory allocation failed for process %d. No suitable block found.\n", i + 1);
int main()
scanf("%d", &numBlocks);
scanf("%d", &blocks[i].size);
blocks[i].allocated = 0;
int processSizes[MAX_PROCESSES];
scanf("%d", &processSizes[i]);
return 0;
OUTPUT