Os Prinout
Os Prinout
LAB”
Subcode: BCS303
Prepared By
OPERATING SYSTEM
Name of the document LABORATORY
BCS303.5 Illustrate file and secondary storage management strategies Applying (K3)
and the need for information protection mechanisms.
Syllabus Content:
CO1
Module 1: 08hrs
Introduction to operating systems, System structures: What operating systems do; PO1 –3
Computer System PO2 –2
PO3 –1
organization; Computer System architecture; Operating System structure; P12 –1
Operating System operations; PSO1-2
Process management; Memory management; Storage management; Protection PSO2-2
Module 2: CO2
Process Management: Process concept; Process scheduling; Operations on 08 hrs.
processes; Inter process communication PO1 –3
Multi-threaded Programming: Overview; Multithreading models; Thread PO2 –2
Libraries; Threading issues. PO3 – 1
Process Scheduling: Basic concepts; Scheduling Criteria; Scheduling PSO1 -2
PSO2 -2
Algorithms; Thread scheduling;
Multiple-processor scheduling,
Textbook 1: Chapter – 3 (3.1-3.4), 4 (4.1-4.4), 5 (5.1 -5.5)
Module 3:
CO3
Module 4: CO4
Memory Management: Memory management strategies: Background; Swapping;
Contiguous memory allocation; Paging; Structure of page table; Segmentation. 08hrs
Virtual Memory Management: Background; Demand paging; Copy-on-write; PO1 –3
PO2 –2
Page replacement; Allocation of frames; Thrashing. PO3 –1
Textbook 1: Chapter -8 (8.1-8.6), 9 (9.1-9.6) P12 –1
PSO1-2
PSO2-2
CO5
Module 5:
08 hrs
File System, Implementation of File System: File system: File concept; Access
methods; Directory and Disk structure; File system mounting; File sharing; PO1 –3
PO2 –2
Implementing File system: File system structure; File system implementation;
PO3 –1
Directory implementation; Allocation methods; Free space management. P12 –1
Secondary Storage Structure, Protection: Mass storage structures; Disk structure; PSO1-2
Disk attachment; Disk scheduling; Disk management; Protection: Goals of PSO2-2
protection, Principles of protection, Domain of protection, Access matrix.
Textbook 1: Chapter – 10 (10.1-10.5) ,11 (11.1-11.5),12 (12.1-12.5), 14 (14.1-
14.4)
Text Books: - (specify minimum two foreign authors text books)
1. Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, Operating System Principles 8th edition,
Wiley-India, 2015
Reference Books:
1. Ann McHoes Ida M Fylnn, Understanding Operating System, Cengage Learning, 6th Edition
2. D.M Dhamdhere, Operating Systems: A Concept Based Approach 3rd Ed, McGraw- Hill, 2013.
3. P.C.P. Bhatt, An Introduction to Operating Systems: Concepts and Practice 4th Edition, PHI(EEE),
2014.
4. William Stallings Operating Systems: Internals and Design Principles, 6th Edition, Pearson.
Useful Websites
1. https://youtu.be/mXw9ruZaxzQ
2. https://youtu.be/vBURTt97EkA
3. https://www.youtube.com/watch?v=783KAB-
tuE4&list=PLIemF3uozcAKTgsCIj82voMK3TMR0YE_f
4. https://www.youtube.com/watch?v=3-
ITLMMeeXY&list=PL3pGy4HtqwD0n7bQfHjPnsWzkeRn6mkO
Assessment:
Type of test/examination: Written examination
Continuous Internal Evaluation(CIE) : 50 marks (Average of two tests will be considered)
Test marks:15
Assignment:10
Practicals:25
Semester End Exam(SEE) : 100 marks (students have to answer all main questions)
which will be reduced to 50 marks
Test duration: 1 :30 hrs
Examination duration: 3 hrs
CO to PO Mapping
PO1: Science and engineering PO7:Environment and Society
Knowledge PO8:Ethics
PO2: Problem Analysis PO9:Individual& Team Work
PO10: Communication
PO3: Design & Development
PO11:Project Mngmt& Finance
PO4:Investigations of Complex PO12:Life long Learning
Problems
PO5: Modern Tool Usage
PO6: Engineer & Society
PSO1: Ability to apply the fundamental concepts of Artificial Intelligence and Machine Learning
todesign and develop solutions to multidisciplinary problems of social concern.
PSO2: Ability to use the inculcated experiential learning for research and development activities
incompliance with National Education Policy.
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
BCS303.1 3 2 1 - - - - - - - - 1 2 2
BCS303.2 3 2 1 - - - - - - - - 1 2 2
BCS303.3 3 2 1 - - - - - - - - 1 2 2
BCS303.4 3 2 1 - - - - - - - - 1 2 2
BCS303.5 3 2 1 - - - - - - - - 1 2 2
BCS303 3 2 1 - - - - - - - - 1 2 2
CO2: Apply appropriate CPU scheduling algorithms for the given problem.
4 CO2 1 Strongly agreed as process management 3
and multi threading in operating system.
Moderately agreed, as problem analysis
2 2
skill in process scheduling.
Weakly agreed as design of multi
3 1
threading models.
Strongly, as individual knowledge en-
12 1
hancement is obtained.
5 PSO 1 Moderately relevant as problem solving ability 2
is enhanced.
CO3: Apply the various techniques for process synchronization and deadlock handling.
7 CO3 1 Strongly agreed as ability to apply engi- 3
neering knowledge in deadlock and pro-
cess synchronization.
Moderately agreed, as problem analysis
2 2
skill in programming is strengthened.
Weakly agreed as programming exper-
3 1
tise alone cannot make designs.
12 Strongly, as individual knowledge enhancement 1
is obtained.
8 PSO 1 Strongly relevant as coding ability is enhanced. 2
CO5: Illustrate file and secondary storage management strategies and the need for information
protection mechanisms.
13 CO5 1 Strongly agreed as ability to apply engi- 3
neering knowledge in file system and
disk management.
Moderately agreed, as problem analysis
2 2
skill in disk management.
Weakly agreed to design disk structure
3 1
and directory structure.
Weekly agreed life long learning
12 knowledge in disk structure of operating 1
system.
14 PSO 1 Moderately relevant as coding ability is 2
enhanced.
15 Moderately, agreed as it depends on individual 2
PSO2 ability to act for social causes.
Program 1.
1. Develop a c program to implement the Process system calls (fork (), exec(),
wait(), create process, terminate process.
int main()
{
pid_t pid; // pid_t is used to store process IDs
int status; // Used to store the status of the child process
pid = fork(); // Create a new process
if (pid == -1)
{
// If fork() returns -1, an error occurred
perror("fork failed");
exit(EXIT_FAILURE);
}
else if (pid == 0)
{
// If fork() returns 0, we are in the child process
printf("Child process, PID = %u\n", getpid());
execlp("ls", "ls", NULL);
// If exec() is successful, it doesn't return; if it does return, there was an error
perror("exec failed");
exit(EXIT_FAILURE);
}
else
{
// If fork() returns a positive number, we are in the parent process
// and the return value is the PID of the newly created child process
printf("Parent process, PID = %u\n", getpid());
if (WIFEXITED(status))
{
printf("Child exited with status %d\n", WEXITSTATUS(status));
}
else
{
printf("Child terminated abnormally\n");
}
// At this point, the child has finished.
exit(EXIT_SUCCESS);
}
}
output
2. Simulate the following CPU scheduling algorithms to find turnaround time and waiting time a)
FCFS
b) SJF c) Round Robin d) Priority
a) FCFS
#include<stdio.h>
int main()
{
int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j;
printf("Enter total number of processes(maximum 20): ");
scanf("%d",&n);
printf("\nEnter Process Burst Time:\n");
for(i=0;i<n;i++)
{
printf("P[%d]: ",i+1);
scanf("%d",&bt[i]);
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=0;
for(j=0;j<i;j++)
wt[i]+=bt[j];
}
Output:
b) SJF
#include<stdio.h>
int main()
{
int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp;
float avg_wt,avg_tat;
printf("Enter number of process: ");
scanf("%d",&n);
printf("\nEnter Burst Time:\n");
for(i=0;i<n;i++)
{
printf("p%d: ",i+1);
scanf("%d",&bt[i]);
p[i]=i+1;
}
for(i=0;i<n;i++)
{
pos=i;
for(j=i+1;j<n;j++)
{
if(bt[j]<bt[pos])
pos=j;
}
temp=bt[i];
bt[i]=bt[pos];
bt[pos]=temp;
temp=p[i];
p[i]=p[pos];
p[pos]=temp;
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=0;
for(j=0;j<i;j++)
wt[i]+=bt[j];
total+=wt[i];
}
avg_wt=(float)total/n;
total=0;
printf("\nProcess\t Burst Time \tWaiting Time\tTurnaround Time");
for(i=0;i<n;i++)
{
tat[i]=bt[i]+wt[i];
total+=tat[i];
printf("\np%d\t\t %d\t\t %d\t\t\t%d",p[i],bt[i],wt[i],tat[i]);
}
avg_tat=(float)total/n;
printf("\n\nAverage Waiting Time=%f",avg_wt);
printf("\nAverage Turnaround Time=%f\n",avg_tat);
return 0;
}
Output
c) Round Robin
#include<stdio.h>
int main()
{
int count,j,n,time,remain,flag=0,time_quantum;
int wait_time=0,turnaround_time=0,at[10],bt[10],rt[10];
printf("Enter Total Process:\t ");
scanf("%d",&n);
remain=n;
for(count=0;count<n;count++)
{
printf("Enter Arrival Time and Burst Time for Process Process Number %d :",count+1);
scanf("%d",&at[count]);
scanf("%d",&bt[count]);
rt[count]=bt[count];
}
printf("Enter Time Quantum:\t");
scanf("%d",&time_quantum);
printf("\n\nProcess\t|Turnaround Time|Waiting Time\n\n");
for(time=0,count=0;remain!=0;)
{
if(rt[count]<=time_quantum && rt[count]>0)
{
time+=rt[count];
rt[count]=0;
flag=1;
}
else if(rt[count]>0)
{
rt[count]-=time_quantum;
time+=time_quantum;
}
if(rt[count]==0 && flag==1)
{
remain--;
printf("P[%d]\t|\t%d\t|\t%d\n",count+1,time-at[count],time-at[count]-bt[count]);
wait_time+=time-at[count]-bt[count];
turnaround_time+=time-at[count];
flag=0;
}
if(count==n-1)
count=0;
else if(at[count+1]<=time)
count++;
else
count=0;
}
Output
d) Priority
#include<stdio.h>
int main()
{
int bt[20],p[20],wt[20],tat[20],pr[20],i,j,n,total=0,pos,temp,avg_wt,avg_tat;
printf("Enter Total Number of Process:");
scanf("%d",&n);
printf("\nEnter Burst Time and Priority\n");
for(i=0;i<n;i++)
{
printf("\nP[%d]\n",i+1);
printf("Burst Time:");
scanf("%d",&bt[i]);
printf("Priority:");
scanf("%d",&pr[i]);
p[i]=i+1;
}
for(i=0;i<n;i++)
{
pos=i;
for(j=i+1;j<n;j++)
{
if(pr[j]<pr[pos])
pos=j;
}
temp=pr[i];
pr[i]=pr[pos];
pr[pos]=temp;
temp=bt[i];
bt[i]=bt[pos];
bt[pos]=temp;
temp=p[i];
p[i]=p[pos];
p[pos]=temp;
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=0;
for(j=0;j<i;j++)
wt[i]+=bt[j];
total+=wt[i];
}
avg_wt=total/n;
total=0;
printf("\nProcess\t Burst Time \tWaiting Time\tTurnaround Time");
for(i=0;i<n;i++)
{
tat[i]=bt[i]+wt[i];
total+=tat[i];
printf("\nP[%d]\t\t %d\t\t %d\t\t\t%d",p[i],bt[i],wt[i],tat[i]);
}
avg_tat=total/n;
printf("\n\nAverage Waiting Time=%d",avg_wt);
printf("\nAverage Turnaround Time=%d\n",avg_tat);
return 0;
}
Output:
Program-3
Develop a C program to simulate producer-consumer problem using
semaphores.
#include<stdio.h>
void main()
{
int buffer[10], bufsize, in, out, produce, consume, choice=0;
in = 0;
out = 0;
bufsize = 10;
while(choice !=3)
{
printf("\n 1. Produce \t 2. Consume \t3. Exit");
printf("\n Enter your choice: ");
scanf("%d", &choice);
switch(choice)
{
case 1: if((in+1)%bufsize==out)
printf("\n Buffer is Full");
else
{
printf("\nEnter the value: ");
scanf("%d", &produce);
buffer[in] = produce;
in = (in+1)%bufsize;
}
break;
case 2: if(in == out)
printf("\nBuffer is Empty");
else
{
consume = buffer[out];
printf("\nThe consumed value is %d", consume);
out = (out+1)%bufsize;
}
break;
}
}
}
Output
PROGRAM 4
Develop a C program which demonstrates inter-process communication
between a reader process and a writer process. Use mkfifo, open, read,
write and close APIs in your program.
/*Writer Process*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
int fd;
char buf[1024];
/* create the FIFO (named pipe) */
char * myfifo = "/tmp/myfifo";
mkfifo(myfifo, 0666);
printf("Run Reader process to read the FIFO File\n");
fd = open(myfifo, O_WRONLY);
write(fd,"Hi", sizeof("Hi"));
/* write "Hi" to the FIFO */
close(fd);
unlink(myfifo); /* remove the FIFO */
return 0;
}
/* Reader Process*/
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#define MAX_BUF 1024
int main()
{
int fd;
/* A temp FIFO file is not created in reader */
char *myfifo = "/tmp/myfifo";
char buf[MAX_BUF];
/* open, read, and display the message from the FIFO */
fd = open(myfifo, O_RDONLY);
read(fd, buf, MAX_BUF);
OUTPUT
PROGRAM 5
Develop a C program to simulate Bankers Algorithm for DeadLock
Avoidance.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int Max[10][10], need[10][10], alloc[10][10], avail[10], completed[10], safeSequence[10];
int p, r, i, j, process, count;
count = 0;
printf("Enter the no of processes : ");
scanf("%d", &p);
for(i = 0; i< p; i++)
completed[i] = 0;
printf("\n\nEnter the no of resources : ");
scanf("%d", &r);
printf("\n\nEnter the Max Matrix for each process : ");
for(i = 0; i < p; i++)
{
printf("\nFor process %d : ", i + 1);
for(j = 0; j < r; j++)
scanf("%d", &Max[i][j]);
}
printf("\n\nEnter the allocation for each process : ");
for(i = 0; i < p; i++)
{
printf("\nFor process %d : ",i + 1);
for(j = 0; j < r; j++)
scanf("%d", &alloc[i][j]);
}
printf("\n\nEnter the Available Resources : ");
for(i = 0; i < r; i++)
scanf("%d", &avail[i]);
for(i = 0; i < p; i++)
for(j = 0; j < r; j++)
need[i][j] = Max[i][j] - alloc[i][j];
do
{
printf("\n Max matrix:\tAllocation matrix:\n");
for(i = 0; i < p; i++)
{
for( j = 0; j < r; j++)
printf(">\n");
}
else
printf("\nThe system is in an unsafe state!!");
}
OUTPUT
PROGRAM-6
Develop a C program to simulate the following contiguous memory
allocation
Techniques
a) Worst fit
#include <stdio.h>
int main()
{
int fragments[10], blocks[10], files[10];
int m, n, number_of_blocks, number_of_files, temp, top = 0;
static int block_arr[10], file_arr[10];
printf("\nEnter the Total Number of Blocks:\t");
scanf("%d",&number_of_blocks);
printf("Enter the Total Number of Files:\t");
scanf("%d",&number_of_files);
printf("\nEnter the Size of the Blocks:\n");
for(m = 0; m < number_of_blocks; m++)
{
printf("Block No.[%d]:\t", m + 1);
scanf("%d", &blocks[m]);
}
printf("Enter the Size of the Files:\n");
for(m = 0; m < number_of_files; m++)
{
printf("File No.[%d]:\t", m + 1);
scanf("%d", &files[m]);
}
for(m = 0; m < number_of_files; m++)
{
OUTPUT
b) Best Fit
#include<stdio.h>
void main()
{
int fragment[20],b[20],p[20],i,j,nb,np,temp,lowest=9999;
static int barray[20],parray[20];
printf("\n\t\t\tMemory Management Scheme - Best Fit");
printf("\nEnter the number of blocks:");
scanf("%d",&nb);
printf("Enter the number of processes:");
scanf("%d",&np);
printf("\nEnter the size of the blocks:-\n");
for(i=1;i<=nb;i++)
{
printf("Block no.%d:",i);
scanf("%d",&b[i]);
}
printf("\nEnter the size of the processes :-\n");
for(i=1;i<=np;i++)
{
printf("Process no.%d:",i);
scanf("%d",&p[i]);
}
for(i=1;i<=np;i++)
{
for(j=1;j<=nb;j++)
{
if(barray[j]!=1)
{
temp=b[j]-p[i];
if(temp>=0)
if(lowest>temp)
{
parray[i]=j;
lowest=temp;
}
}
}
fragment[i]=lowest;
barray[parray[i]]=1;
lowest=10000;
}
printf("\nProcess_no\tProcess_size\tBlock_no\tBlock_size\tFragment");
for(i=1;i<=np && parray[i]!=0;i++)
printf("\n%d\t\t%d\t\t%d\t\t%d\t\t%d",i,p[i],parray[i],b[parray[i]],fragment[i]);
}
OUTPUT:
c) First Fit
#include<stdio.h>
#define max 25
void main()
{
int frag[max],b[max],f[max],i,j,nb,nf,temp,highest=0;
static int bf[max],ff[max];
printf("\n\tMemory Management Scheme - First Fit");
printf("\nEnter the number of blocks:");
scanf("%d",&nb);
printf("Enter the number of files:");
scanf("%d",&nf);
printf("\nEnter the size of the blocks:-\n");
for(i=1;i<=nb;i++)
{
printf("Block %d:",i);
scanf("%d",&b[i]);
}
printf("Enter the size of the files :-\n");
for(i=1;i<=nf;i++)
{
printf("File %d:",i);
scanf("%d",&f[i]);
}
for(i=1;i<=nf;i++)
{
for(j=1;j<=nb;j++)
{
if(bf[j]!=1) //if bf[j] is not allocated
{
temp=b[j]-f[i];
if(temp>=0)
if(highest<temp)
{
ff[i]=j;
highest=temp;
}
}
}
frag[i]=highest;
bf[ff[i]]=1;
highest=0;
}
printf("\nFile_no:\tFile_size :\tBlock_no:\tBlock_size:\tFragement");
for(i=1;i<=nf;i++)
printf("\n%d\t\t%d\t\t%d\t\t%d\t\t%d",
i,f[i],ff[i],b[ff[i]],frag[i]);
}
OUTPUT
Program-7
Develop a C program to simulate page replacement algorithms
a) FIFO
#include<stdio.h>
int main()
{
int i,j,n,a[50],frame[10],no,k,avail,count=0;
printf("\n ENTER THE NUMBER OF PAGES:\n");
scanf("%d",&n);
printf("\n ENTER THE PAGE NUMBER :\n");
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
printf("\n ENTER THE NUMBER OF FRAMES :");
scanf("%d",&no);
for(i=0;i<no;i++)
frame[i]= -1;
j=0;
printf("\tref string\t page frames\n");
for(i=1;i<=n;i++)
{
printf("%d\t\t",a[i]);
avail=0;
for(k=0;k<no;k++)
if(frame[k]==a[i])
avail=1;
if (avail==0)
{
frame[j]=a[i];
j=(j+1)%no;
count++;
for(k=0;k<no;k++)
printf("%d\t",frame[k]);
}
printf("\n");
}
printf("Page Fault Is %d",count);
return 0;
}
OUTPUT
b) LRU
#include<stdio.h>
int i,j,nof,nor,flag=0,ref[50],frm[50],pf=0,victim=-1;
int recent[10],lrucal[50],count=0;
int lruvictim();
void main()
{
printf("\n\t\t\t LRU PAGE REPLACEMENT ALGORITHM");
printf("\n Enter no.of Frames....");
scanf("%d",&nof);
printf(" Enter no.of reference string..");
scanf("%d",&nor);
printf("\n Enter reference string..");
for(i=0;i<nor;i++)
scanf("%d",&ref[i]);
printf("\n\n\t\t LRU PAGE REPLACEMENT ALGORITHM ");
printf("\n\t The given reference string:");
printf("\n………………………………..");
for(i=0;i<nor;i++)
printf("%4d",ref[i]);
for(i=1;i<=nof;i++)
{
frm[i]=-1;
lrucal[i]=0;
} for(i=0;i<10;i++)
recent[i]=0;
printf("\n");
for(i=0;i<nor;i++)
{
flag=0;
printf("\n\t Reference NO %d->\t",ref[i]);
for(j=0;j<nof;j++)
{
if(frm[j]==ref[i])
{
flag=1;
break;
}
}
if(flag==0)
{
count++;
if(count<=nof)
victim++;
else
victim=lruvictim();
pf++;
frm[victim]=ref[i];
for(j=0;j<nof;j++)
printf("%4d",frm[j]);
}
recent[ref[i]]=i;
}
printf("\n\n\t No.of page faults...%d",pf);
}
int lruvictim()
{
int i,j,temp1,temp2;
for(i=0;i<nof;i++)
{
temp1=frm[i];
lrucal[i]=recent[temp1];
}
temp2=lrucal[0];
for(j=1;j<nof;j++)
{
if(temp2>lrucal[j])
temp2=lrucal[j];
}
for(i=0;i<nof;i++)
if(ref[temp2]==frm[i])
return i;
return 0;
}
OUTPUT
Program-8
{
if(strcmp(f, dir.fname[i])==0)
{
printf("File %s is found ", f);
break;
}
}
if(i==dir.fcnt)
printf("File %s not found",f);
break;
case 4: if(dir.fcnt==0)
printf("\nDirectory Empty");
else
{
printf("\nThe Files are -- ");
for(i=0;i<dir.fcnt;i++)
printf("\t%s",dir.fname[i]);
}
break;
default: exit(0);
}
}
}
OUTPUT
b) Two-Level Directory
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
struct
{
char dname[10],fname[10][10];
int fcnt;
}dir[10];
void main()
{
int i,ch,dcnt,k;
char f[30], d[30];
dcnt=0;
while(1)
{
printf("\n\n1. Create Directory\t2. Create File\t3. Delete File");
printf("\n4. Search File\t\t5. Display\t6. Exit\tEnter your choice -- ");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("\nEnter name of directory -- ");
scanf("%s", dir[dcnt].dname);
dir[dcnt].fcnt=0;
dcnt++;
printf("Directory created");
break;
case 2: printf("\nEnter name of the directory -- ");
scanf("%s",d);
for(i=0;i<dcnt;i++)
if(strcmp(d,dir[i].dname)==0)
{
printf("Enter name of the file -- ");
scanf("%s",dir[i].fname[dir[i].fcnt]);
printf("File created");
break;
}
if(i==dcnt)
printf("Directory %s not found",d);
break;
case 3: printf("\nEnter name of the directory -- ");
scanf("%s",d);
for(i=0;i<dcnt;i++)
{
if(strcmp(d,dir[i].dname)==0)
printf("\nDirectory\tFiles");
for(i=0;i<dcnt;i++)
{
printf("\n%s\t\t",dir[i].dname);
for(k=0;k<dir[i].fcnt;k++)
printf("\t%s",dir[i].fname[k]);
}
}
break;
default:exit(0);
}
}
}
OUTPUT
Program-9
else
exit(0);
getch();
}
OUTPUT
Program-10
uptrack = j;
}
void scan(int n)
{
int i;
int seekcount = 0;
request[n] = head;
request[n + 1] = SIZE - 1;
request[n + 2] = 0;
printf("ENTER THE PRE REQUEST :\n");
scanf("%d", &pre);
scan(n + 3);
}
OUTPUT
VIVA QUESTIONS
1 What is Operating System
2 What is a Kernel
3 What is a process
4 What are the different states of the process
5 What is a thread
6 What is the difference between process and thread
7 What are the benefits of Multithread programming
8 What is a thrashing
9 What is Buffer
10 What is Virtual Memory
11 What is demand paging
12 What are the different scheduling algorithm
13 Describe the objective of multi programming
14 What is fragmentation
15 What is the basic function of Paging
16 What is direct access method
17 What is multitasking
18 What is caching
19 What are interrupts
20 What are the advantages of Semaphores
21 What is IPC
22 What is a Zombie process
23 What is context stretching
24 What is a critical section
25 What are the advantages of multi threating
26 Define the term bounded waiting
27 What is concurrence
28 What is a deadlock
29 Write down the advantages of virtual memory
30 How to recover from a dead lock