Professional Documents
Culture Documents
File1 OS
File1 OS
● Windows
● Linux
● Unix
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
Disadvantages
● Security Concerns
● Paid software
● Infection assults
● Rebooting a framework
2. LINUX
Advantages
Disadvantages
● Software compatibility
● Gaming
● Hardware Compatibility
● Learning curve
3. UNIX
Advantages
● Very stable
● Multitasking
Disadvantages
● Cryptic commands
● Gaming
● Software Compatibility
2 Windows XP
3 LINUX
● 512 MB RAM
4 UNIX
● RAM:1 GB
● Processor: IBM 604e processor with a clock speed of 375 MHz or faster
● wait(): Suspends the execution of the current process until one of its child processes terminates.
● waitpid(): Suspends the execution of the current process until a specific child process
terminates.
● waitid(): Suspends the execution of the current process until a specific child process or group of
● exit(): Terminates the current process and returns the exit status to the parent process.
● getppid(): Returns the PID of the parent process of the current process.
● setsid(): Creates a new session and sets the process group ID.
● getrusage(): Gets resource usage statistics for the current or child processes.
● recv() and send(): Receives and sends data over a network socket.
● pread() and pwrite(): Reads and writes data at a specific offset within a file.
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++)
ct[i]=ct[i-1]+bt[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++)
printf("p%d\t%d\t%d\t%d\t%d\t%d\n",i,at[i],bt[i],ct[i],tat[i],wt[i]);
return 0;
OUTPUT
SJF SCHEDULING
PROGRAM
#include<stdio.h>
int main() {
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];
burst_time[smallest] = 0;
return 0;
OUTPUT
SRTF SCHEDULING
PROGRAM
#include <stdio.h>
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]);
x[i]=b[i];
b[9]=9999;
for(time=0;count!=n;time++)
smallest=9;
for(i=0;i<n;i++)
smallest=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
int temp=*a;
*a=*b;
*b=temp;
int main()
int n;
scanf("%d",&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++)
temp=priority[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];
int total_Turn_Around = 0;
total_Turn_Around += burst[i];
printf("Average
TurnAround Time is
%f",avg_Turn_Around);
return 0;
OUTPUT
PRIORITY SCHEDULING(Preemptive)
PROGRAM
#include<stdio.h>
struct process
int WT,AT,BT,TAT,PT;
};
int main()
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;
Avg_TAT=total_TAT/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:
PROGRAM
#include<stdio.h>
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];
scanf("%d", &time_quantum);
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;
OUTPUT