Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 61

MUTHAYAMMAL ENGINEERING COLLEGE

(AUTONOMOUS)
RASIPURAM – 637 408.

DEPARTMENT OF INFORMATION TECHNOLOGY

ACADEMIC YEAR 2023-24

21ITC10 OPERATING SYSTEMS LABORATORY

LAB MANUAL

FOR

IV SEMESTER

Name:

Year/Sem: Branch:

Roll No/Reg No:


MUTHAYAMMAL ENGINEERING COLLEGE
(AUTONOMOUS)
DEPARTMENT OF INFORMATION TECHNOLOGY

Subject Name : OPERATING SYSTEMS LABORATORY

Subject Code : 21ITC10

Year : 2023-24

PREPARED BY REVIEWED BY APPROVED BY

Name

Designation

Signature

Date
21ITC10 OPERATING SYSTEMS LABORATORY

OBJECTIVES: The student should be made to:

1. Learn shell programming and the use of filters in the UNIX environment.
2. Be exposed to programming in C using system calls.
3. Learn to use the file system related system calls.
4. Be exposed to process creation and inter process communication.
5. Be familiar with implementation of CPU Scheduling Algorithms, page replacement
algorithms and Deadlock avoidance

LIST OF EXPERIMENTS:

1. File exploring basic commands under Linux Operating systems


2. Program using Shell scripts.
3. Basic process management algorithms.
4. Process synchronization algorithms.
5. Implementing various memory allocation methods.
6. Implementing paging and segmentation.
7. Implementing various page replacement policies.
8. Implementation of file system calls.
9. Implementation of Pattern matching.
10. Implementation of disk scheduling algorithms.

TOTAL: 30 PERIODS

OUTCOMES: At the end of the course, the student should be able to

1. Implement deadlock avoidance, and Detection Algorithms


2. Compare the performance of various CPU Scheduling Algorithm
3. Critically analyze the performance of the various page replacement algorithms
4. Create processes and implement IPC
5. Develop various algorithms for CPU scheduling and for deadlock avoidance
MUTHAYAMMAL ENGINEERING COLLEGE
(AUTONOMOUS)
RASIPURAM – 637 408.

DEPARTMENT OF INFORMATION TECHNOLOGY

Subject Name : OPERATING SYSTEMS LABORATORY

University : Anna University, Chennai

Subject Code : 21ITC10

Year of Syllabus : 2023 – 2024

PREPARED BY REVIEWED BY APPROVED BY


Name of the
Faculty

Designation

Signature

Date
INDEX
S.No. Date Name of the Experiment Marks Signature
EX. NO. : 1
DATE : BASIC COMMANDS IN Linux

AIM:

To study the basic commands in Linux.

COMMANDS:

1. TASK : To display the system date and time.


COMMAND : date.
SYNTAX : date.
EXPLANATION: This command displays the current system date and time on the
screen.
OUTPUT :.

2. TASK : To display the current month.


COMMAND : date.
SYNTAX : date +%m.
EXPLANATION: This command displays the current month on the screen.
OUTPUT :.

3. TASK : To display the name of the current month.


COMMAND : date.
SYNTAX : date +%h.
EXPLANATION: This command displays the name of the current month on the
screen.
OUTPUT :

4. TASK : To display the current system date.


COMMAND : date.
SYNTAX : date +%d.
EXPLANATION: This command displays the current system date on the screen.
OUTPUT :

5. TASK : To display the current system date (year).


COMMAND : date.
SYNTAX : date +%y.
EXPLANATION: This command displays the current year on the screen.
OUTPUT :.

6. TASK : To display the current system time.


COMMAND : date.
SYNTAX : date +%H.
EXPLANATION: This command displays the current system time (in hours) on the
screen.
OUTPUT :.
7. TASK : To display the current system time.
COMMAND : date.
SYNTAX : date +%M.
EXPLANATION: This command displays the current system time (in minutes) on the
screen.
OUTPUT :

8. TASK : To display the current system time.


COMMAND : date.
SYNTAX : date +%S.
EXPLANATION: This command displays the current system time (in seconds) on the
screen.
OUTPUT :.

9. TASK : To display the calendar of the current month.


COMMAND : calendar.
SYNTAX : cal.
EXPLANATION: This command displays the calendar of the current month on the
screen.
OUTPUT :

10. TASK : To display user-defined message.


COMMAND : echo.
SYNTAX : echo “message”.
EXPLANATION: This command displays on the screen the argument of the echo
command.
OUTPUT :

11. TASK : To display the details of all users.


COMMAND : who.
SYNTAX : who.
EXPLANATION : This command lists the information about all the users who have
logged on to that system.
OUTPUT

12. TASK : To display the user detail.


COMMAND : who.
SYNTAX : who am i.
EXPLANATION : This command displays information about the current user of the
system on the screen.
OUTPUT :

13. TASK : To create a directory.


COMMAND : make directory.
SYNTAX : mkdir.
EXPLANATION : This command is used to create a new directory with the specified
name.
EXAMPLE : mkdir student.
OUTPUT :
14. TASK : To change directory.
COMMAND : change directory.
SYNTAX : cd directory name.
EXPLANATION : This command is used to switch from one directory to another.
EXAMPLE : cd staff.
OUTPUT :

15. TASK : To delete a directory.


COMMAND : remove directory.
SYNTAX : rmdir directory name
EXPLANATION : This command is used to delete the specified directory.
EXAMPLE : rmdir student.
OUTPUT :

16. TASK : To come out of a sub-directory.


COMMAND : change directory.
SYNTAX : cd ..
EXPLANATION : This command helps in switching to the main directory.
OUTPUT :

17. TASK : To list all the files and directories.


COMMAND : list.
SYNTAX : ls.
EXPLANATION : This command displays all the files and directories of the system.
OUTPUT :

18. TASK : To create a file.


COMMAND : cat.
SYNTAX : cat> file name.
EXPLANATION : This command leads to the creation of a new file with the specified
file name and contents.
EXAMPLE : cat> wind.
OUTPUT :

19. TASK : To view a file.


COMMAND : cat.
SYNTAX : cat file name.
EXPLANATION : This command displays the contents of the specified file.
EXAMPLE : cat wind.
OUTPUT :

20. TASK : To copy a file.


COMMAND : copy.
SYNTAX : cp sourcefile destinationfile.
EXPLANATION : This command produces a copy of the source file and is stored in
the specified destination file by overwriting its previous
contents.
EXAMPLE : cp sun moon.
OUTPUT :
21. TASK : To move a file.
COMMAND : move.
SYNTAX : mv sourcefile destinationfile.
EXPLANATION : After moving the contents of the source file into destination file,
the source file is deleted.
EXAMPLE : mv sun moon.
OUTPUT :

22. TASK : To display / cut a column from a file.


COMMAND : cut.
SYNTAX : cut –c no. file name.
EXPLANATION : This command displays the characters of a particular column in the
specified file.
EXAMPLE : cut –c3 moon.
OUTPUT :

23. TASK : To delete a file.


COMMAND : remove.
SYNTAX : rm file name.
EXPLANATION : This command deletes the specified file from the directory.
EXAMPLE : rm sun.
OUTPUT :

24. TASK : To retrieve a part of a file.


COMMAND : head.
SYNTAX : head -no. of rows file name.
EXPLANATION : This command displays the specified no. of rows form the top
of the specified file.
EXAMPLE : head -1 sun.
OUTPUT :

25. TASK : To retrieve a file.


COMMAND : tail.
SYNTAX : tail -no. of rows file name.
EXPLANATION : This command displays the specified no. of rows form the bottom
of the specified file.
EXAMPLE : tail -1 moon.
OUTPUT :

26. TASK : To sort the contents of a file.


COMMAND : sort.
SYNTAX : sort file name.
EXPLANATION : This command helps in sorting the contents of a file in ascending
order.
EXAMPLE : sort win.
OUTPUT :
.
27. TASK : To display the no. of characters in a file.
COMMAND : word count.
SYNTAX : wc file name.
EXPLANATION : This command displays on the screen the no. of rows, words, and
the sum of no. of characters and words.
EXAMPLE : wc ball.
OUTPUT :

28. TASK : To display the calendar of a year.


COMMAND : cal.
SYNTAX : cal year.
EXPLANATION: This command displays on the screen the calendar of the specified year.
EXAMPLE : cal 2007.
OUTPUT :
SHELL PROGRAMMING

Ex.No :2a
CONCATENATION OF TWO STRINGS
Date:

Aim:

To write a shell program to concatenate two strings.

Algorithm:

Step1: Enter into the vi editor and go to the insert mode for entering the code
Step2: Read the first string.
Step3: Read the second string
Step4: Concatenate the two strings
Step5: Enter into the escape mode for the execution of the result and verify the output

Program:

echo Enter first string:


read s1
echo Enter second string:
read s2
s3=$s1$s2
echo Concatinated stringis $s3

Output
Enter first string
Operating
Enter second string
Systems
Concatenated string
Operating systems

Result:

Thus the shell program to concatenate two strings is executed and output is verified successfully
Ex.No. :2b
COMPARISON OF TWO STRINGS
Date:

Aim:

To write a shell program to compare the two strings.

Algorithm:

Step1: Enter into the vi editor and go to the insert mode for entering the code
Step2: Read the first string.
Step3: Read the second string
Step4: Compare the two strings using the if loop
Step5: If the condition satisfies then print that two strings are equal else print two
strings are not equal.
Step6: Enter into the escape mode for the execution of the result and verify the output

Program:

s1="hi"
s2="hi"

if ["$s1" == "$s2"]
then
echo match
fi

Output

match

Result:
Thus the shell program to compare the two strings is executed and output is verified
successfully.

Ex.No:2c
MAXIMUM OF THREE NUMBERS
Date:

Aim:

To write a shell program to find greatest of three numbers.

Algorithm:

Step1: Declare the three variables.


Step2: Check if A is greater than B and C.
Step3: If so print A is greater.
Step4: Else check if B is greater than C.
Step5: If so print B is greater.
Step6: Else print C is greater.

Program:

#!/bin/bash

echo "enter first number"

read first

echo "enter second number"

read sec

echo "enter third number"

read third

if [ $first -gt $sec ] ; then

if [ $first -gt $third ] ; then

echo -e " $first is greatest number "

else

echo -e " $third is greatest number "

fi

else

if [ $sec -gt $third ] ; then

echo -e " $sec is greatest number "

else

echo -e " $third is greatest number "

fi
fi

Output

Enter first number 46


Enter second number 10
Enter third number 103
Third is greatest number

Result:
Thus the shell program to find the maximum of three numbers is executed and output is verified
successfully.

Ex.No:2d
FIBONACCI SERIES
Date:

Aim:

To write a shell program to generate fibonacci series.

Algorithm :

Step 1 : Initialise a to 0 and b to 1.


Step 2 : Print the values of 'a' and 'b'.
Step 3 : Add the values of 'a' and 'b'. Store the added value in variable 'c'.
Step 4 : Print the value of 'c'.
Step 5 : Initialise 'a' to 'b' and 'b' to 'c'.
Step 6 : Repeat the steps 3,4,5 till the value of 'a' is less than 10.

Program :

clear
echo "How many number of terms to be generated ?"
read n
x=0
y=1
i=2
echo "Fibonacci Series up to $n terms :"
echo "$x"
echo "$y"
while [ $i -lt $n ]
do
i=`expr $i + 1 `
z=`expr $x + $y `
echo "$z"
x=$y
y=$z
done

Output

How many number of terms to be generated


5
Fibonacci series upto 5 terms
01123

Result :

Thus the shell program to find the fibonacci series is executed and output is verified successfully
Ex.No:2e
ARITHMETIC OPERATIONS USING CASE
Date:

Aim:

To write a shell program to perform the arithmetic operations using case

Algorithm :

Step 1 : Read the input variables and assign the value


Step 2 : Print the various arithmetic operations which we are going to perform
Step 3 : Using the case operator assign the various functions for the arithmetic
operators.
Step 4 : Check the values for all the corresponding operations.
Step 5 : Print the result and stop the execution.
.
Program :

#!/bin/sh

a=10
b=20

val=`expr $a + $b`
echo "a + b : $val"

val=`expr $a - $b`
echo "a - b : $val"

val=`expr $a \* $b`
echo "a * b : $val"

val=`expr $b / $a`
echo "b / a : $val"

val=`expr $b % $a`
echo "b % a : $val"

if [ $a == $b ]
then
echo "a is equal to b"
fi

if [ $a != $b ]
then
echo "a is not equal to b"
fi

OUTPUT:

a + b : 30
a - b : -10
a * b : 200
b / a : 2
b % a : 0
a is not equal to b

Result :
Thus the shell program to perform arithmetic operations using case is executed and output is
verified successfully.
EX NO:3a
IMPLEMENTATION OF FIRST COME FIRST SERVE
Date: SCHEDULING ALGORITHM

Aim

To write a C-program to implement the FCFS scheduling algorithm

Algorithm

1. Start the process

2. Declare the array size

3. Get the number of processes to be inserted

4. Get the value

5. Start with the first process from it’s initial position let other process to be in queue

6. Calculate the total number of burst time

7. Display the values

8. Stop the process

Program

#include<stdio.h>
main()
{
int n,a[10],b[10],t[10],w[10],g[10],i,m;
float att=0,awt=0;
for(i=0;i<10;i++)
{
a[i]=0; b[i]=0; w[i]=0; g[i]=0;
}
printf("enter the number of process");
scanf("%d",&n);
printf("enter the burst times");
for(i=0;i<n;i++)
scanf("%d",&b[i]);
printf("\nenter the arrival times");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
g[0]=0;
for(i=0;i<10;i++)
g[i+1]=g[i]+b[i];
for(i=0;i<n;i++)
{
w[i]=g[i]-a[i];
t[i]=g[i+1]-a[i];
awt=awt+w[i];
att=att+t[i];
}
awt =awt/n;
att=att/n;
printf("\n\tprocess\twaiting time\tturn arround time\n");
for(i=0;i<n;i++)
{
printf("\tp%d\t\t%d\t\t%d\n",i,w[i],t[i]);
}
printf("the average waiting time is %f\n",awt);
printf("the average turn around time is %f\n",att);
}
Output
enter the number of process 4
enter the burst times
4 9 8 3
enter the arrival times
0 2 4 3
process waiting time turn arround time
p0 0 4
p1 2 11
p2 9 17
p3 18 21
the average waiting time is 7.250000
the average turn around time is 13.250000

Result

Thus the program for FCFS is implemented and verified.


EX NO:3b
IMPLEMENTATION OF SHORTEST JOB FIST
SCHEDULING ALGORITHM
DATE:

Aim

To write a C-Program to implement the shortest job first scheduling algorithm

Algorithm

1. Start the process

2. Declare the array size

3. Get the number of elements to be inserted

4. Select the process which have shortest burst will execute first

5. If two process have same burst length then FCFS scheduling algorithm used

6. Make the average waiting the length of next process

7. Start with the first process from it’s selection as above and let other process to be in
queue

6. Calculate the total number of burst time

7. Display the values

8. Stop the process

Program
#include<stdio.h>
int main()
{

int n,j,temp,temp1,temp2,pr[10],b[10],t[10],w[10],p[10],i;

float att=0,awt=0;

for(i=0;i<10;i++)
{
b[i]=0;w[i]=0;
}

printf("enter the number of process");


scanf("%d",&n);
printf("enter the burst times");
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
p[i]=i;
}
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(b[i]>b[j])
{
temp=b[i];
temp1=p[i];
b[i]=b[j];
p[i]=p[j];
b[j]=temp;
p[j]=temp1;
}
}
}
w[0]=0;
for(i=0;i<n;i++)
w[i+1]=w[i]+b[i];
for(i=0;i<n;i++)
{
t[i]=w[i]+b[i];
awt=awt+w[i];
att=att+t[i];
}
awt=awt/n;
att=att/n;
printf("\n\t process \t waiting time \t turn around time \n");
for(i=0;i<n;i++)
printf("\t p[%d] \t %d \t\t %d \n",p[i],w[i],t[i]);
printf("the average waitingtimeis %f\n",awt);
printf("the average turn around time is %f\n",att);
return 1;
}
Output
enter the number of process 5
enter the burst times
2 4 5 6 8

process waiting time turn around time


p[0] 0 2
p[1] 2 6
p[2] 6 11
p[3] 11 17
p[4] 17 25
the average waitingtime is 7.200000
the average turn around time is 12.200000

Result
The program for SJF was implemented and hence verified

EX NO:3c
IMPLEMENTATION OF ROUND ROBIN SCHEDULING
ALGORITHM
DATE:

Aim

To write a C-program to implement the round robin scheduling algorithm

Algorithm

1. Start the process

2. Declare the array size

3. Get the number of elements to be inserted & value

5. Set the time sharing system with preemption

6. Define quantum is defined from 10 to 100ms

7. Declare the queue as a circular

8. Make the CPU scheduler goes around the ready queue allocating CPU to each process
for the time interval specified

9. Make the CPU scheduler picks the first process and sets time to interrupt after quantum
expired dispatches the process

9. If the process have burst less than the time quantum than the process release the CPU

10. If the process have bust greater then time quantum then time will go off and cause
interrupt to OS and the process put into the tail of ready queue and the schedule select
next process

11. Display the result & Stop the process

Program

#include<stdio.h>
int ttime,i,j,temp;
main()
{
int pname[10],btime[10],pname2[10],btime2[10];
int n,x,z;
printf("Enter the no. of process:");
scanf("%d",&n);
printf("Enter the process name and burst time for the process\n");
for(i=0;i<n;i++)
{
printf("Enter the process name:");
scanf("%d",&pname2[i]);
printf("Enter burst time for the process %d:",pname2[i]);
scanf("%d",&btime2[i]);
}
printf("PROCESS NAME \t\t BURST TIME\n");
for(i=0;i<n;i++)
printf("%d\t\t\t %d\n",pname2[i],btime2[i]);
z=1;
while(z==1)
{
ttime=0;
for(i=0;i<n;i++)
{
pname[i]=pname2[i];
btime[i]=btime2[i];
}
printf ("PRESS 1.ROUND ROBIN 2.EXIT\n");
scanf("%d",&x);
switch(x)
{
case 1:
rrobin(pname,btime,n);
break;
case 2:
exit(0);
break;
default:
printf("Invalid option");
break;
}
printf("\n\n If you want to continue press 1:");
scanf("%d",&z);
}
}

rrobin(int pname[],int btime[],int n)


{
int tslice;
j=0;
printf("\n\t ROUND ROBIN SCHEDULING \n\n");
printf("Enter the time slice:\n");
scanf("%d",&tslice);
printf("PROCESS NAME \t REMAINING TIME\t TOTAL TIME");
while(j<n)
{
for(i=0;i<n;i++)
{
if(btime[i]>0)
{
if(btime[i]>=tslice)
{
ttime+=tslice;
btime[i]=btime[i]-tslice;
printf("\n%d\t\t %d \t\t %d",pname[i],btime[i],ttime);
if(btime[i]==0)
j++;
}
else
{
ttime+=btime[i];
btime[i]=0;
printf("\n%d\t\t %d \t\t %d",pname[i],btime[i],ttime);
}
}
}
}
}

Output

Enter the no. of process: 4


Enter the process name and burst time for the process
Enteer the process name: 1
Enter burst time for the process 1: 8
Enteer the process name: 2
Enter burst time for the process 2: 3
Enteer the process name: 3
Enter burst time for the process 3: 6
Enteer the process name: 4
Enter burst time for the process 4: 1

PROCESS NAME BURST TIME


1 8
2 3
3 6
4 1

PRESS 1.ROUND ROBIN 2.EXIT


1
ROUND ROBIN SCHEDULING
Enter the time slice:
2
PROCESS NAME REMAINING TIME TOTAL TIME
1 6 2
2 1 4
3 4 6
4 0 7
1 4 9
2 0 10
3 2 12
1 2 14
3 0 16

Result
The program for round robin scheduling was implemented and hence verified

EX No:3d
PRIORITY SCHEDULING
Date:

AIM:

To write a C program to implement CPU scheduling algorithm for priority scheduling.

PROBLEM DESCRIPTION:

Cpu scheduler will decide which process should be given the CPU for its execution.For this it use
different algorithm to choose among the process. one among that algorithm is fcfs algorithm.
In this algorithm the process which arrive first is given the cpu after finishing its request only it will
allow cpu to execute other process.

ALGORITHM:

Step1:Get the number of process,burst time and priority.


Step2:Using for loopi=0 to n-1 do step 1 to 6.
Step3:If i=0,wait time=0,T[0]=b[0];
Step4:T[i]=T[i-1]+b[i] and wt[i]=T[i]-b[i].
Step5: Total waiting time is calculated by adding the waiting time for lack process.
Step6: Total turn around time is calculated by adding all total time of each process.
Step7: Calculate Average waiting time by dividing the total waiting time by total numberof process.
Step8: Calculate Average turn around time by dividing the total time by the number of process.
Step9: Display the result.

PROGRAM:

void main()
{
int i,j,n,t,turn[20],burst[20],p[20],wt[20],c[20];
float await,aturn,twait=0,tturn=0;
printf(“\nEnter the value of n:”);
scanf(“%d”,&n);
printf(“\n Enter the process no burst and arrival time”);
for(i=0;i<n;i++)
{
scanf(“%d”,&c[i]);
scanf(“%d”,&burst[i]);
scanf(“%d”,&p[i]);
}
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
if(p[i]>p[j])
{
t=p[i];
p[i]=p[j];
p[j]=t;
t=burst[i];
burst[i]=burst[j];
burst[j]=t;
t=c[i];
c[i]=c[j];
c[j]=t;
}
}
for(i=0;i<n;i++)
{
if(i==0)
{
wt[i]=0;
turn[i]=burst[i];
}
}
else
{
turn[i]=turn[i-1]+burst[i];
wt[i]=turn[i]-burst[i];
twait=twait+wt[i];
tturn=tturn+turn[i];
}
await=twait/n;
aturn=tturn/n;
printf(“pno\tbtime\tatime\twtime\tttime”);
for(i=0;i<n;i++)
{
printf(“\n%d\t%d\t%d\t%d\t%d\n”,c[i],burst[i],p[i],wt[i],turn[i]);
}
printf(“\n The average waiting time is:%f”,await);
printf(“\n The average turn around time is:%f”,aturn);
}

Output:

Enter the process burst no and priority


1 15 2
251
3 10 3
pno btime priority wtime ttime
25105
1 15 2 5 20
3 10 3 20 30
The average waiting time is: 8.333333
The average turnaround time is:18.333334

RESULT:
Thus C program to implement CPU scheduling algorithm for priority scheduling was executed
successfully.

EX NO:4
PRODUCER CONSUMER PROBLEM
DATE:

AIM:

To write a c-program to implement the producer – consumer problem using semaphores.


Algorithm:
1) Start the program.
2) Declare the required variables.
3) Initialize the buffer size and get maximum item you want to produce.
4) Get the option, which you want to do either producer, consumer or exit from
the operation.
5) If you select the producer, check the buffer size if it is full the producer should
not produce the item or otherwise produce the item and increase the value buffer size.
6) If you select the consumer, check the buffer size if it is empty the consumer should
not consume the item or otherwise consume the item and decrease the value of buffer
size.
7) If you select exit come out of the program.
8) Stop the program.

PROGRAM
#include<stdio.h>
int mutex=1,full=0,empty=3,x=0;
main()
{
int n;
void producer();
void consumer();
int wait(int);
int signal(int);
printf("\n1.PRODUCER\n2.CONSUMER\n3.EXIT\n");
while(1)
{
printf("\nENTER YOUR CHOICE\n");
scanf("%d",&n);
switch(n)
{
case 1:
if((mutex==1)&&(empty!=0))
producer();
else
printf("BUFFER IS FULL");
break;
case 2:
if((mutex==1)&&(full!=0))
consumer();
else
printf("BUFFER IS EMPTY");
break;
case 3:
exit(0);
break;
}
}
}
int wait(int s)
{
return(--s);
}
int signal(int s)
{
return(++s);
}
void producer()
{
mutex=wait(mutex);
full=signal(full);
empty=wait(empty);
x++;
printf("\nproducer produces the item%d",x);
mutex=signal(mutex);
}
void consumer()
{
mutex=wait(mutex);
full=wait(full);
empty=signal(empty);
printf("\n consumer consumes item%d",x);
x--;
mutex=signal(mutex);
}
OUTPUT:-
1.PRODUCER
2.CONSUMER
3.EXIT
ENTER YOUR CHOICE
1
producer produces the item1
ENTER YOUR CHOICE
1
producer produces the item2
ENTER YOUR CHOICE
1
producer produces the item3
ENTER YOUR CHOICE
1
BUFFER IS FULL
ENTER YOUR CHOICE
2
consumer consumes item3
ENTER YOUR CHOICE
2
consumer consumes item2
ENTER YOUR CHOICE
2
consumer consumes item1
ENTER YOUR CHOICE
2
BUFFER IS EMPTY
ENTER YOUR CHOICE
3

Result

Thus the C program to implement producer consumer problem was executed successfully.
EX NO: 5a
DATE: IMPLEMENTATION OF FIRST-FIT M EMORY A LLOCATION

AIM:

To write a C program to implement first fit algorithm for memory management.

DESCRIPTION:

One of the simplest methods for memory allocation is to divide memory into several
fixed-sized partitions. Each partition may contain exactly one process. In this multiple -partition
method, when a partition is free, a process is selected from the input queue and is loaded into
the free partition.
When the process terminates, the partition becomes available for another process.
The operating system keeps a table indicating which parts of memory are available and
which are occupied. Finally, when a process arrives and needs memory, a memory
section large enough for this process is provided.
When it is time to load or swap a process into main memory, and if there is
more than one free block of memory of sufficient size, then the operating system
must
decide which free block to allocate.
Best-fit strategy chooses the block that is closest in size to the
request. First-fit chooses the first available block that is large enough.
Worst-fit chooses the largest available block in the memory

Algorithm

1. Start the program.


2. Input memory blocks with size and processes with size.
3. Initialize all memory blocks as free.
4. Start by picking each process and check if it can be assigned to current block.
5. If size-of-process <= size-of-block, then assign and check for next process.
6. If not then keep checking the further blocks.
7. Stop the process

PROGRAM

#include<stdio.h>
#include<conio.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];
clrscr();
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]);
getch();
}

Output

Result
Thus the C program to implement first fit memory allocation was executed successfully.
EX NO: 5b
DATE: IMPLEMENTATION OF BEST-FIT M EMORY A LLOCATION

AIM:

To write a C program to implement Best-fit algorithm for memory management.

Algorithm

1. Start the program.


2. Input memory blocks with size and processes with size.
3. Initialize all memory blocks as free.
4. Sorts the blocks according to their sizes.
5. Allocate the process to the best which is equal to or slightly greater than the process.
6. Stop the process

PROGRAM

#include<stdio.h>
#include<conio.h>
#define max 25
void main()
{
int frag[max],b[max],f[max],i,j,nb,nf,temp,lowest=10000;
static int bf[max],ff[max];
clrscr();
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)
{
temp=b[j]-f[i];
if(temp>=0)
if(lowest>temp)
{
ff[i]=j;
lowest=temp;
}
}
}
frag[i]=lowest;
bf[ff[i]]=1;
lowest=10000;
}
printf("\nFile No\tFile Size \tBlock No\tBlock Size\tFragment");
for(i=1;i<=nf && ff[i]!=0;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]);
getch();

Output

Result

Thus the C program to implement best fit memory allocation was executed successfully.
EX NO: 5c
DATE: IMPLEMENTATION OF WORST-FIT MEMORY A LLOCATION

AIM:

To write a C program to implement Worst-fit algorithm for memory management.

ALGORITHM

1. Start the program.


2. Input memory blocks with size and processes with size.
3. Initialize all memory blocks as free.
4. Sorts the blocks according to their sizes in descending order.
5. Allocate the process to the first largest hole
6. Stop the process

PROGRAM

#include<stdio.h>
#include<conio.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];
clrscr();
printf("\n\tMemory Management Scheme - Worst 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]);
getch();
}

Output

Result

Thus the C program to implement worst fit memory allocation was executed successfully.
EX NO: 6a MEMORY MANAGEMENT SCHEME- PAGING
DATE:

AIM:

To write a C program to implement memory management using paging technique.

ALGORITHM:

1. Start the program.


2. Read the base address, page size, number of pages and memory unit.
3. If the memory limit is less than the base address display the memory limit is less
than limit.
4. Create the page table with the number of pages and page address.
5. Read the page number and displacement value.
6. If the page number and displacement value is valid, add the displacement value with
the address corresponding to the page number and display the result.
7. Display the page is not found or displacement should be less than page size.
8. Stop the program.

PROGRAM

#include<stdio.h>
#define MAX 50
int main()
{
int page[MAX],i,n,f,ps,off,pno;
clrscr();
printf("\nEnter the no of pages in memory");
scanf("%d",&n);
printf("\nEnter page size");
scanf("%d",&ps);
printf("\nEnter no of frames");
scanf("%d",&f);
for(i=0;i<n;i++)
page[i]=-1;
printf("\nEnter the page table\n");
printf("(Enter frame no as -1 if that page is not present in any frame)\n\n");
printf("\npageno\tframeno\n-------\t-------");
for(i=0;i<n;i++)
{
printf("\n\n%d\t\t",i);
scanf("%d",&page[i]);
}
printf("\n\nEnter the logical address(i.e,page no & offset):");
scanf("%d%d",&pno,&off);
if(page[pno]==-1)
printf("\n\nThe required page is not available in any of frames");
else
printf("\n\nPhysical address(i.e,frame no & offset):%d,%d",page[pno],off);
getch();
return 1;
}
Output

Enter the no of page in memory 5


Enter page size 5
Enter no of frames 60
Enter the page table

Page no Frame no
0 5
1 2
2 3
3 6
4 8

Enter the logic address 2


35
Physical address (Frame no of offset): 3,35

Result
Thus the C program to implement memory management scheme-paging was executed
successfully
EX NO: 6b MEMORY MANAGEMENT SCHEME- SEGMENTATION
DATE:

AIM:

To write a C program to implement memory management using segmentation

ALGORITHM:

1. Start the program.


2. Read the base address, number of segments, size of each segment, memory limit.
3. If memory address is less than the base address display “invalid memory limit”.
4. Create the segment table with the segment number and segment address and display it.
5. Read the segment number and displacement.
6. If the segment number and displacement is valid compute the real address and display
the same.
7. Stop the program.

PROGRAM

#include<stdio.h>
#include<unistd.h>
void main()
{
int b[20],l[20],n,i,pa,s,a,d;
printf(“\nProgram for segmentation”);
printf(“\nEnter the number of segments:”);
scanf(“%d”,&n);
printf(“\nEnter the base address and limit register:”);
for(i=0;i<n;i++)
{
scanf(“%d”,&b[i]);
scanf(“%d”,&l[i])
}
printf(“\nEnter the logical address ie segment no, offset:”);
scanf(“%d”,&s,&d);
for(i=0;i<n;i++)
{
if(i==s)
{
if(d<l[i])
{
pa=b[i]+d;
a=b[i];
printf(“(“\n\tPageNo.\t BaseAdd. PhysicalAdd. \n\t %d \t %d \t %d \t ”,s,a,pa);
exit(0);
}
else
{
printf(“\nPage size exceeds”);
exit(0);
}
}
}
printf(“\nInvalid segment”);
}
Output

Enter the number of segmentation: 5


Enter the base address and limit register
1400 1000
6300 400
4300 400
3200 1100
4700 1000
Enter the logical address ie segment no, offset
2
4300
Pageno base address Physical address
2 4300 4364

Result

Thus the C program to implement memory management scheme-segmentation was executed


successfully
EX NO: 7a
IMPLEMENTING VARIOUS PAGE REPLACEMENT
POLICIES
DATE: IMPLEMENTATION OF FIFO PAGE REPLACEMENT
ALGORITHM
AIM

To write a C-program to implement FIFO page replacement algorithm

ALGORITHM

1. Start the process

2. Declare the size with respect to page length

3. Check the need of replacement from the page to memory

4. Check the need of replacement from old page to new page in memory

5. Forma queue to hold all pages

6. Insert the page require memory into the queue

7. Check for bad replacement and page fault

8. Get the number of processes to be inserted

9. Display the values

10. Stop the process

PROGRAM

#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

Result

Thus the C program to implement FIFO page replacement algorithm was executed
successfully
EX NO:7b
DATE: IMPLEMENTATION OF LRU PAGE REPLACEMENT
ALGORITHM
Aim

To write a C-program a program to implement LRU page replacement algorithm

Algorithm

1. Start the process

2. Declare the size

3. Get the number of pages to be inserted

4. Get the value

5. Declare counter and stack

6. Select the least recently used page by counter value

7. Stack them according the selection.

8. Display the values

9. Stop the process

PROGRAM

#include<stdio.h>
main()
{
int q[20],p[50],c=0,c1,d,f,i,j,k=0,n,r,t,b[20],c2[20];
printf("Enter no of pages:");
scanf("%d",&n);
printf("Enter the reference string:");
for(i=0;i<n;i++)
scanf("%d",&p[i]);
printf("Enter no of frames:");
scanf("%d",&f);
q[k]=p[k];
printf("\n\t%d\n",q[k]);
c++;
k++;
for(i=1;i<n;i++)
{
c1=0;
for(j=0;j<f;j++)
{
if(p[i]!=q[j])
c1++;
}
if(c1==f)
{
c++;
if(k<f)
{
q[k]=p[i];
k++;
for(j=0;j<k;j++)
printf("\t%d",q[j]);
printf("\n");
}
else
{
for(r=0;r<f;r++)
{
c2[r]=0;
for(j=i-1;j<n;j--)
{
if(q[r]!=p[j])
c2[r]++;
else
break;
}
}
for(r=0;r<f;r++)
b[r]=c2[r];
for(r=0;r<f;r++)
{
for(j=r;j<f;j++)
{
if(b[r]<b[j])
{
t=b[r];
b[r]=b[j];
b[j]=t;
}
}
}
for(r=0;r<f;r++)
{
if(c2[r]==b[0])
q[r]=p[i];
printf("\t%d",q[r]);
}
printf("\n");
}
}
}
printf("\nThe no of page faults is %d",c);
}
Output

Result

Thus the C program to implement LRU page replacement algorithm was executed successfully
Ex. No: 7c OPTIMAL (LFU) PAGE REPLACEMENT ALGORITHM
DATE:

AIM:

To write a C-program a program to implement optimal page replacement technique.

ALGORITHM:

Here we select the page that will not be used for the longest period of time.
1. Start Program
2. Read Number Of Pages And Frames
3. Read Each Page Value
4. Search For Page In The Frames
5. If Not Available Allocate Free Frame
6. If No Frames Is Free Repalce The Page With The Page That Is Not Used In Next N Pages(N Is
Number Of Frames)
7. Print Page Number Of Page Faults
8. Stop process.

PROGRAM

#include<stdio.h>
#include<conio.h>
int i,j,nof,nor,flag=0,ref[50],frm[50],pf=0,victim=-1;
int recent[10],optcal[50],count=0;
int optvictim();
void main()
{
clrscr();
printf("\n OPTIMAL PAGE REPLACEMENT ALGORITHN");
printf("\n.................................");
printf("\nEnter the no.of frames");
scanf("%d",&nof);

printf("Enter the no.of reference string");


scanf("%d",&nor);
printf("Enter the reference string");
for(i=0;i<nor;i++)
scanf("%d",&ref[i]);
clrscr();
printf("\n OPTIMAL PAGE REPLACEMENT ALGORITHM");
printf("\n................................");
printf("\nThe given string");
printf("\n....................\n");
for(i=0;i<nor;i++)
printf("%4d",ref[i]);
for(i=0;i<nof;i++)
{
frm[i]=-1;
optcal[i]=0;
}
for(i=0;i<10;i++)
recent[i]=0;
printf("\n");
for(i=0;i<nor;i++)
{
flag=0;
printf("\n\tref 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=optvictim(i);
pf++;
frm[victim]=ref[i];
for(j=0;j<nof;j++)
printf("%4d",frm[j]);
}
}
printf("\n Number of page faults: %d",pf);
getch();
}
int optvictim(int index)
{
int i,j,temp,notfound;

for(i=0;i<nof;i++)

{
notfound=1;
for(j=index;j<nor;j++)
if(frm[i]==ref[j])
{
notfound=0;
optcal[i]=j;
break;
}
if(notfound==1)
return i;
}
temp=optcal[0];
for(i=1;i<nof;i++)
if(temp<optcal[i])
temp=optcal[i];
for(i=0;i<nof;i++)
if(frm[temp]==frm[i])
return i;
return 0;
}
Output

Result

Thus the C program to implement optimal page replacement algorithm was executed successfully
IMPLEMENTATION OF FILE SYSTEM CALLS
EX. NO: 8a READING FROM A FILE
Date:

AIM

To create the file, read data from the file, update the file.

ALGORITHM

1.Get the data from the user.


2.Open a file.
3.Read from the file.
4.Close the file.

PROGRAM

#include<stdio.h>
int main()
{
char str[100];
FILE *fp;
fp=fopen("file1.dat","r");
while(!feof(fp))
{
fscanf(fp,"%s",str);
printf(" %s ",str);
}
fclose(fp);
}

Output

You are reading from the file

Result
Thus the C program to read from a file was executed successfully
EX. NO: 8b WRITING FROM A FILE
Date:

AIM

To write a C program to write the data into a


file.

ALGORITHM

1. Get the data from the user.


2. Open a file.
3. Write the data from the file.
4. Get the data and update the file.

PROGRAM

#include<stdio.h>
int main()
{
char str[100];
FILE *fp;
printf("Enter the string");
gets(str);
fp=fopen("file1.dat","w+");
while(!feof(fp))
{
fscanf(fp,"%s",str);
}
fprintf(fp,"%s",str);
}

Output

You are writing to the file

Result
Thus the C program to write a file was executed successfully
EX. NO: 8c FILE CREATION
Date:

AIM

To write a C program to create a file.

ALGORITHM

1: Start the program.


2: Create the file using create function and assign a variable to it.
3: If the value of the variable is less then print file cannot be created
,otherwise print file is created.
4: Stop the program.

PROGRAM

void main()
{
int id;
if(id=creat(“z.txt”,0)==-1)
{
printf(“cannot create the file”);
exit(1);
}
else
{
printf(“file is created”);
exit(1);
}
}

Output

File is created

Result
Thus the C program to write a file was executed successfully
EX. NO: 09 IMPLEMENTATION OF PATTERN MATCHING

AIM

To write a C program to implement pattern matching.

ALGORITHM

1: Start the program.


2: reads the strings
3: Check if the first string is matched with the second string
4: If it is matched then print the location
5: If it defers then print it is not found
6: Stop the program.

PROGRAM

#include <stdio.h>
#include <string.h>
int match(char [], char []);

int main() {
char a[100], b[100];
int position;
printf("Enter some text\n");
gets(a);
printf("Enter a string to find\n");
gets(b);
position = match(a, b);
if (position != -1) {
printf("Found at location: %d\n", position + 1);
}
else {
printf("Not found.\n");
}
return 0;
}

int match(char text[], char pattern[]) {


int c, d, e, text_length, pattern_length, position = -1;
text_length = strlen(text);
pattern_length = strlen(pattern);
if (pattern_length > text_length) {
return -1;
}
for (c = 0; c <= text_length - pattern_length; c++) {
position = e = c;

for (d = 0; d < pattern_length; d++) {


if (pattern[d] == text[e]) {
e++;
}
else {
break;
}
}
if (d == pattern_length) {
return position;
}
}
return -1;
}

Output

Enter some text: computer Programming


Enter a string to find: Programming

Found at location : 10

Result
Thus the C program to write a file was executed successfully
EX. NO: 10 IMPLEMENTATION OF DISK SCHEDULING ALGORITHMS
DATE:

AIM

To write a „C‟ program to implement the Disk Scheduling algorithm for First Come First
Served (FCFS), Shortest Seek Time First (SSTF), and SCAN.

DESCRIPTION

Disk Scheduling is the process of deciding which of the cylinder request is in the ready queue is
to be accessed next. The access time and the bandwidth can be improved by scheduling the
servicing of disk I/O requests in good order.
Access Time:
The access time has two major components: Seek time and Rotational
Latency. Seek Time:
Seek time is the time for disk arm to move the heads to the cylinder containing the
desired sector.
Rotational Latency:
Rotational latency is the additional time waiting for the disk to rotate the desired
sector to the disk head.
Bandwidth:
The disk bandwidth is the total number of bytes transferred, divided by the total
time between the first request for service and the completion of the last transfer.

ALGORITHM

1. Input the maximum number of cylinders and work queue and its head starting position.
2. First Come First Serve Scheduling (FCFS) algorithm – The operations are performed in
order requested.
3. There is no reordering of work queue.
4. Every request is serviced, so there is no starvation.
5. The seek time is calculated.
6. Shortest Seek Time First Scheduling (SSTF) algorithm – This algorithm selects
the request with the minimum seek time from the current head position.
7. Since seek time increases with the number of cylinders traversed by the head, SSTF
chooses the pending request closest to the current head position.
8. The seek time is calculated.
9. SCAN Scheduling algorithm – The disk arm starts at one end of the disk, and
moves toward the other end, servicing requests as it reaches each cylinder, until it
gets to the other end of the disk.
10. At the other end, the direction of head movement is reversed, and servicing continues.
11. The head continuously scans back and forth across the disk.
12. The seek time is calculated.
13. Display the seek time and terminate the program

PROGRAM

#include<stdio.h>
#include<math.h>
void fcfs(int noq, int qu[10], int st)
{

int i,s=0;
for(i=0;i<noq;i++)
{
s=s+abs(st-qu[i]);
st=qu[i];
}

printf("\n Total seek time :%d",s);


}
void sstf(int noq, int qu[10], int st, int visit[10])
{
int min,s=0,p,i;
while(1)
{
min=999;
for(i=0;i<noq;i++)
if (visit[i] == 0)
{
if(min > abs(st - qu[i]))
{
min = abs(st-qu[i]);
p = i;
}
}
if(min == 999)
break;
visit[p]=1;
s=s + min;
st = qu[p];
}
printf("\n Total seek time is: %d",s);
}
void scan(int noq, int qu[10], int st, int ch)
{
int i,j,s=0;
for(i=0;i<noq;i++)
{
if(st < qu[i])
{
for(j=i-1; j>= 0;j--)
{
s=s+abs(st - qu[j]);
st = qu[j];
}
if(ch == 3)
{
s = s + abs(st - 0);
st = 0;
}
for(j = 1;j < noq;j++)
{
s= s + abs(st - qu[j]);
st = qu[j];
}
break;
}
}
printf("\n Total seek time : %d",s);
}
int main()
{
int n,qu[20],st,i,j,t,noq,ch,visit[20];
printf("\n Enter the maximum number of cylinders : ");
scanf("%d",&n);
printf("enter number of queue elements");
scanf("%d",&noq);
printf("\n Enter the work queue");
for(i=0;i<noq;i++)
{
scanf("%d",&qu[i]);
visit[i] = 0;
}
printf("\n Enter the disk head starting posision: \n");
scanf("%d",&st);
while(1)
{
printf("\n\n\t\t MENU \n");
printf("\n\n\t\t 1. FCFS \n");
printf("\n\n\t\t 2. SSTF \n");
printf("\n\n\t\t 3. SCAN \n");
printf("\n\n\t\t 4. EXIT \n");
printf("\nEnter your choice: ");
scanf("%d",&ch);
if(ch > 2)
{
for(i=0;i<noq;i++)
for(j=i+1;j<noq;j++)
if(qu[i]>qu[j])
{
t=qu[i];
qu[i] = qu[j];
qu[j] = t;
}
}
switch(ch)
{
case 1: printf("\n FCFS \n");
printf("\n*****\n");
fcfs(noq,qu,st);
break;
case 2: printf("\n SSTF \n");
printf("\n*****\n");
sstf(noq,qu,st,visit);
break;
case 3: printf("\n SCAN \n");
printf("\n*****\n");
scan(noq,qu,st,ch);

break;
case 4: exit(0);
}
}
}

Output

Enter the maximum number of cylinder: 5


Enter number of queue element: 4

Enter the work Queue:3


2
1
6
Menu
1. FCFS
2. SSTF
3. SCAN
4. EXIT

Enter your choice: 2


Total seek time:7
SSTF

Result
Thus the C program to implement disk scheduling algorihtms was executed successfully
VIVA QUESTIONS
1. What is an operating system?
2. What are the different operating systems?
3. What are the basic functions of an operating system?
4. What is kernel?
5. What is difference between micro kernel and macro kernel?
6. What is dead lock?
7. What is a process?
8. What are the states of a process?
9. What is starvation and aging?
10. What is semaphore?
11. What is context switching?
12. What is a thread?
13. What is process synchronization?
14. What is virtual memory?
15. What is thrashing?
16. What is fragmentation? Tell about different types of fragmentation?
17. What are necessary conditions for dead lock?
18. What is cache memory?
19. What is logical and physical addresses space?
20. Differentiate between Complier and Interpreter?
21. What is Throughput, Turnaround time, waiting time and Response time?
22. What is Memory-Management Unit (MMU)?
23. What is a Real-Time System?
24. What is a trap and trapdoor?
25. When is a system in safe state?
26. Explain the concept of the Distributed systems?
27. What is cache-coherency?
28. What is a long term scheduler & short term schedulers?
29. Explain the meaning of mutex.
30. What is pre-emptive and non-preemptive scheduling?
31. What is busy waiting?
32. What is dual-mode operation?
33. What is a device queue?
34. What are the different types of Real-Time Scheduling?
35. What are the disadvantages of context switching?
36. What are local and global page replacements?
37. Explain the concept of the batched operating systems?
38. When is a system in safe state?
39. What is Dispatcher?
40. Define page replacement.

You might also like