Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
85 views

Operating System Lab Manual

OS

Uploaded by

Hare Ram Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

Operating System Lab Manual

OS

Uploaded by

Hare Ram Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Operating System Lab

(KCS-451)

Laboratory Manual
For
Bachelor of Technology
In
Computer Science and Engineering

IV Semester

Department of Computer Science and Engineering

Greater Noida Institute of Technology

Department of Computer Science and Engineering

List of Practical’s

OPERATING SYSTEM LAB (KCS-451)

1. Study of hardware and software requirements of different operating systems (UNIX, LINUX, WINDOWS XP,
WINDOWS7/8)
2. Execute various UNIX system calls for i. Process management ii. File management iii. Input/output Systems calls
3. Implement CPU Scheduling Policies: i. SJF ii. Priority iii. FCFS iv. Multi-level Queue
4. Implement file storage allocation technique: i. Contiguous (using array) ii. Linked –list(using linked-list) iii. Indirect
allocation (indexing)
5. Implementation of contiguous allocation techniques: i. Worst-Fit ii. Best- Fit iii. First- Fit
6. Calculation of external and internal fragmentation i. Free space list of blocks from system ii. List process file from
the system
7. Implementation of compaction for the continually changing memory layout and calculate total movement of data
8. Implementation of resource allocation graph RAG)
9. Implementation of Banker‟s algorithm
10. Conversion of resource allocation graph (RAG) to wait for graph (WFG) for each type of method used for storing
graph.
11. Implement the solution for Bounded Buffer (producer-consumer) problem using inter process communication
Techniques-Semaphores
12. Implement the solutions for Readers-Writers problem using inter process communication technique –Semaphore

Page no. 1 of KCS451 Lab Manual


INSTITUTE VISION AND MISSION

Vision of Institute
Be known globally for value-added Education Innovation Research at the intersection of
disciplines in service of humankind.

Mission of Institute
➢ Place a multidisciplinary engineering education ecosystem that transforms learners into future innovators,
entrepreneurs, and professional leaders.

➢ Create an ambiance of interdisciplinary research, innovation, and creativity to address regional and global
challenges for benefit of human life and the environment.

➢ Provide the environment for enhancing knowledge, and inculcating critical & design thinking, life skills
through quality learning Systems.

➢ Collaborate with globally renowned academic & research institutions and corporate for improving
productivity and economics.
DEPARTMENT VISION AND MISSION
Vision of the Department

To produce computer science and engineering graduates with problem solving abilities,

research aptitude, teamwork, and ethical values to meet the needs of industry and society.

Mission of the Department

✓ To prepare students with strong technical skills and analytical minds for real time

industrial needs.

✓ To nurture the students to contribute in research and innovation for nation building.

✓ To develop students with leadership qualities to be entrepreneurs and contribute their

services to society.

Program Educational Objectives

Page no. 2 of KCS451 Lab Manual


PEO 1: Prepare graduates to have knowledge and competency for careers in related
to computer science.
PEO 2: Prepare graduates to become leader in fields related to computer Science.
PEO 3: Prepare graduates to pursue higher education in engineering or other
professional fields.
PEO 4: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.

PROGRAMME OUTCOMES

Program Statement
Outcom
e
PO1 Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and
an engineering specialization to the solution of complex computer engineering problems.
PO2 Problem analysis: Identify, formulate, review research literature, and analyze complex computer
engineering problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.

PO3 Design/development of solutions: Design solutions for complex computer engineering problems and
design system components or processes that meet the specific needs with appropriate considerations for
the public health and safety, and the cultural, societal, and environmental considerations.
PO4 Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide conclusions
PO5 Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering
and IT tools including prediction and modeling to complex engineering activities with an understanding
of the limitations
PO6 The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent relevant to the professional engineering
practices
PO7 Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development
PO8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norm of the
engineering practices
PO9 Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings
PO10 Communications: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions
PO11 Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
PO12 Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life learning in the broadest context of technological change.

PROGRAMME SPECIFIC OUTCOMES (PSOs)

On completion of the B.Tech (Computer Science & Engineering), the graduates will be able to

Page no. 3 of KCS451 Lab Manual


PSO-1: Professional Skill: will be able to understand the concepts of Computer Science &
Engineering and its application in databases, system software, web designing, big data
analytics, and machine learning techniques, artificial intelligence and networking, for efficient
design of computer-based systems of varying complexity.

PSO-2: Problem-Solving Skills: will be able to understand, apply standard practices,


techniques & tools for development of software projects using open-ended programming
environments, which support higher order cognitive skills like data interpretation, formulation of
hypothesis and experimentation, to deliver a quality product.

PSO-3: Successful Career and Entrepreneurship: will be able to employ the best programming
skills, environments, and platforms, to identify and build innovative career options, and
enthusiasm for higher studies.

Subject: Operating Systems Lab (KCS451)

Blooms
CO Course outcomes
Level
Design and implement various Non Pre-emptive CPU scheduling
CO1 BL6
Algorithm's.

CO2 Design and implement various Pre-emptive CPU scheduling Algorithm's. BL6

CO3 Apply various deadlock policies & memory management concepts and BL3

Page no. 4 of KCS451 Lab Manual


verify the performance.
Implement various page replacement algorithms and verify the associated
CO4 BL3
performance.

CO5 Apply Disk scheduling algorithms and analyze the performance. BL3

CO – PO / PSO Mapping
CO PO1 PO PO PO PO PO PO PO8 PO PO1 PO1 PO1 PSO PSO PSO
2 3 4 5 6 7 9 0 1 2 1 2 3
CO1 2 3 1 1 2 2 2 1 1
CO2 3 2 2 3 2 2 2 2 2
CO3 3 2 2 3 2 2 2 2 2
CO4 3 2 2 3 2 2 2 2 2
CO5 3 2 2 3 2 2 2 2 2
Averag 1.80
2.80 2.20 1.80 2.60 2.00 2.00 2.00 1.80
e

Experiment 1: Study of hardware and software requirements of different operating systems (UNIX, LINUX,
WINDOWS XP, WINDOWS7/8)

Objective: to make familiar with hardware and software requirements for the different types of operating
systems.

Steps to be followed
UNIX:
Hardware Requirements:
 Minimum of 64MB of RAM
 Minimum of 500MB of free hard disk space
 Pentium-compatible processor
Software Requirements:

Page no. 5 of KCS451 Lab Manual


 UNIX kernel
 Command line interface
LINUX:
Hardware Requirements:
 Minimum of 512MB of RAM
 Minimum of 20GB of free hard disk space
 Pentium-compatible processor
Software Requirements:
 Linux kernel
 Graphical User Interface (GUI)
 Command line interface
WINDOWS XP:
Hardware Requirements:
 Minimum of 64MB of RAM (128MB recommended)
 Minimum of 1.5GB of free hard disk space
 Pentium-compatible processor
Software Requirements:
 Windows XP operating system
 DirectX 9.0c or higher
WINDOWS 7/8:
Hardware Requirements:
 Minimum of 1GB of RAM (2GB recommended)
 Minimum of 16GB of free hard disk space (20GB recommended)
 1 GHz or faster processor
Software Requirements:
 Windows 7/8 operating system
 DirectX 9 graphics device with WDDM 1.0 or higher driver

UNIX:
Hardware Requirements:
64MB of RAM is the minimum requirement, but a larger amount of memory is recommended for better
performance. Some UNIX distributions recommend 256MB or more.
500MB of free hard disk space is the minimum requirement, but again, more is recommended depending on
the intended use case.
A Pentium-compatible processor is usually sufficient, but some UNIX distributions may have specific
processor requirements.
Software Requirements:
The UNIX kernel is the core of the operating system and provides the basic functionality for all other
software to run on top of.
The command line interface (CLI) is the primary way to interact with the system, using text-based commands
to perform tasks like navigating the file system, launching applications, and managing users and permissions.
LINUX:
Hardware Requirements:
Most modern Linux distributions recommend at least 512MB of RAM, but some distributions may require
more depending on the intended use case.
20GB of free hard disk space is recommended, but again, this can vary depending on the intended use case.

Page no. 6 of KCS451 Lab Manual


A Pentium-compatible processor is usually sufficient, but some distributions may have specific processor
requirements.
Software Requirements:
The Linux kernel is the core of the operating system and provides the basic functionality for all other software
to run on top of.
Most Linux distributions include a graphical user interface (GUI) that provides a visual way to interact with
the system. Some distributions may also offer alternative interfaces, like a command line interface (CLI) or a
text-based interface.
The CLI is the traditional way to interact with Linux, using text-based commands to perform tasks like
navigating the file system, launching applications, and managing users and permissions.
WINDOWS XP:
Hardware Requirements:
64MB of RAM is the minimum requirement for Windows XP to run, but 128MB or more is recommended
for better performance.
1.5GB of free hard disk space is the minimum requirement, but more is recommended depending on the
intended use case.
A Pentium-compatible processor running at 233 MHz or faster is required.
Software Requirements:
Windows XP is a complete operating system that includes a graphical user interface and support for a wide
range of hardware and software applications.
DirectX 9.0c or higher is required to run some advanced graphics applications and games.
WINDOWS 7/8:
Hardware Requirements:
Windows 7/8 require at least 1GB of RAM to run, but 2GB or more is recommended for better performance.
At least 16GB of free hard disk space is required for a 32-bit installation of Windows 7/8, or 20GB for a 64-
bit installation.
A 1 GHz or faster processor is required for both 32-bit and 64-bit versions.
Software Requirements:
Windows 7/8 include a graphical user interface and support for a wide range of hardware and software
applications.
DirectX 9 graphics device with WDDM 1.0 or higher driver is required to run some advanced graphics
applications and games.

Windows 10/11
Hardware Requirements:
 Processor: 1 gigahertz (GHz) or faster processor or System on a Chip (SoC)
 RAM: 4 gigabytes (GB) or greater
 Storage: 64 GB or greater storage device (such as a hard drive or solid state drive (SSD))
 Graphics Card: DirectX 12 compatible graphics / WDDM 2.x
 Display: 720p or greater resolution display
 Internet connection: Internet connectivity is necessary to perform updates and to download and
take advantage of some features.
Software Requirements:
 Windows 10/11 is a complete operating system that includes a graphical user interface
and support for a wide range of hardware and software applications.
 The operating system includes the latest version of the Windows kernel, which provides
the basic functionality for all other software to run on top of.
 Windows 10/11 includes Microsoft Edge as the default web browser.
 DirectX 12 is included in Windows 10/11, which provides support for advanced graphics
applications and games.

Page no. 7 of KCS451 Lab Manual


Microsoft Office Suite, which includes popular productivity applications like Word, Excel, and PowerPoint,
can be purchased separately or as part of a subscription to Microsoft 365.
It's worth noting that these are just the recommended requirements, and the actual hardware and software
requirements for Windows 10/11 can vary depending on the specific version of the operating system and its
intended use case. For example, running more demanding software applications or games may require higher-
end hardware.

Difference between 32 bit and 64 bit os


The primary difference between a 32-bit and 64-bit operating system (OS) is the amount of memory it can
address. Here are some key differences between the two:
 Memory: A 32-bit OS can address up to 4GB of RAM, while a 64-bit OS can address much more
memory, usually up to 2^64 bytes of RAM, which is essentially unlimited for practical purposes.
 Performance: 64-bit operating systems can perform faster than their 32-bit counterparts on
machines with a 64-bit processor, due to the larger memory address space and the ability to
perform more simultaneous calculations.
 Compatibility: 32-bit software applications can run on both 32-bit and 64-bit operating systems, but
64-bit software applications can only run on a 64-bit operating system. This means that some older
hardware or software may not work on a 64-bit OS.
 Security: 64-bit operating systems can provide better security than 32-bit operating systems, as
they can take advantage of hardware-based security features such as Data Execution Prevention
(DEP), which helps to prevent malicious code from executing.
Overall, if you have a 64-bit processor and more than 4GB of RAM, you may want to consider a 64-bit
operating system to take full advantage of your hardware. However, if you are running older software or
hardware, a 32-bit operating system may be more compatible

Page no. 8 of KCS451 Lab Manual


Experiment 2. Execute various UNIX system calls for i. Process management ii. File management iii.
Input/output Systems calls

Objective : To make familiar with unix system calls for the process, file and input output management.
Steps to be followed:
We will use online linux compiler : onecompiler.com
Program: Use of fork system call
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
fork();
printf("Using fork() system call\n");
return 0;
}

Output:

Using fork() system call


Using fork() system call

Program : use of process id system calls


#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
int p=getpid();
fork();
printf("Using fork() system call\n");
printf( "the process id is : %d", p);
return 0;
}
Output:
Using fork() system call
the process id is : 7943Using fork() system call
the process id is : 7943

Page no. 9 of KCS451 Lab Manual


Experiment -3
Experiment Objective-: C Program for FCFS CPU scheduling algorithm
Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm
Program Code:-

#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
char p[10][5];
int tot=0,wt[10],i,n;
float avg=0;
clrscr();
printf("enter no of processes:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter process%d name:\n",i+1);
scanf("%s",&p[i]);
printf("enter process time");
scanf("%d",&pt[i]);
}

wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=wt[i-1]+et[i-1];
tot=tot+wt[i];
}
avg=(float)tot/n;
printf("p_name\t P_time\t w_time \n");
for(i=0;i<n;i++)
printf("%s\t%d\t%d\n",p[i],et[i],wt[i]);
printf("total waiting time=%d\n avg waiting time=%f",tot,avg);
getch();
}

Program Output:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter process2 name: bbb
enter process time: 3
enter process3 name: ccc
enter process time: 2
enter process4 name: ddd
enter process time: 5
enter process5 name: eee
enter process time: 1
p_name P_time w_time
aaa 4 0
bbb 3 4
ccc 2 7
ddd 5 9

Page no. 10 of KCS451 Lab Manual


eee 1 14
total waiting time=34
avg waiting time=6.80

Experiment-4

Experiment Objective: C program for SJF CPU Scheduling Algorithm

Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm
Program Code:-
#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
char p[10][5],temp[5];
int tot=0,wt[10],pt[10],i,j,n,temp1;
float avg=0;
clrscr();
printf("enter no of processes:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter process%d name:\n",i+1);
scanf("%s",&p[i]);
printf("enter process time");
scanf("%d",&pt[i]);
}

Page no. 11 of KCS451 Lab Manual


for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(pt[i]>pt[j])
{
temp1=pt[i];
pt[i]=pt[j];
pt[j]=temp1;
strcpy(temp,p[i]);
strcpy(p[i],p[j]);
strcpy(p[j],temp);
}
}
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=wt[i-1]+et[i-1];
tot=tot+wt[i];
}
avg=(float)tot/n;
printf("p_name\t P_time\t w_time\n");
for(i=0;i<n;i++)
printf("%s\t%d\t%d\n",p[i],et[i],wt[i]);
printf("total waiting time=%d\n avg waiting time=%f",tot,avg);
getch();
}
Program Output:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter process2 name: bbb
enter process time: 3
enter process3 name: ccc
enter process time: 2
enter process4 name: ddd
enter process time: 5
enter process5 name: eee
enter process time: 1

p_name P_time w_time

eee 1 0
ccc 2 1
bbb 3 3
aaa 4 6
ddd 5 10
total waiting time=20
avg waiting time=4.00

Page no. 12 of KCS451 Lab Manual


Experiment-5

Experiment Objective: Shortest Remaining Time First ( SRTF) CPU scheduling in c


Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm
Program Code:-
#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;
printf("enter the number of Processes:\n");
scanf("%d",&n);
printf("enter arrival time\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("enter burst time\n");
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++)
{
if(a[i]<=time && b[i]<b[smallest] && b[i]>0 )
smallest=i;
}
b[smallest]--;
if(b[smallest]==0)
{
count++;
end=time+1;
avg=avg+end-a[smallest]-x[smallest];
tt= tt+end-a[smallest];
}
}

Page no. 13 of KCS451 Lab Manual


printf("\n\nAverage waiting time = %lf\n",avg/n);
printf("Average Turnaround time = %lf",tt/n);
return 0;
}

Program Output:-
Enter the number of Processes:
4
enter arrival time
0
1
2
3
enter burst time
8
4
9
5
Average waiting time = 6.500000
Average Turnaround time = 13.000000

Experiment-6

Experiment Objective:-C Program for Priority CPU Scheduling Algorithm

Page no. 14 of KCS451 Lab Manual


Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm
Program Code:-
#include<stdio.h>
#include<conio.h>
void main()
{
char p[10][5],temp[5];
inti,j,pt[10],wt[10],totwt=0,pr[10],temp1,n;
float avgwt;
clrscr();
printf("enter no of processes:");

scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter process%d name:",i+1);
scanf("%s",&p[i]);
printf("enter process time:");
scanf("%d",&pt[i]);
printf("enter priority:");
scanf("%d",&pr[i]);
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(pr[i]>pr[j])
{
temp1=pr[i];
pr[i]=pr[j];
pr[j]=temp1;
temp1=pt[i];
pt[i]=pt[j];
pt[j]=temp1;
strcpy(temp,p[i]);
strcpy(p[i],p[j]);
strcpy(p[j],temp);
}
}
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=wt[i-1]+et[i-1];
totwt=totwt+wt[i];
}
avgwt=(float)totwt/n;
printf("p_name\tp_time\t priority\tw_time\n");
for(i=0;i<n;i++)
{
printf(" %s\t %d\t %d\t %d\n" ,p[i],pt[i],pr[i],wt[i]);
}
printf("total waiting time=%d\navg waiting time=%f",tot,avg);
getch();
}

Page no. 15 of KCS451 Lab Manual


Program Output:
enter no of processes: 5
enter process1 name: aaa
enter process time: 4
enter priority:5
enter process2 name: bbb
enter process time: 3
enter priority:4
enter process3 name: ccc
enter process time: 2
enter priority:3
enter process4 name: ddd
enter process time: 5
enter priority:2
enter process5 name: eee
enter process time: 1
enter priority:1

p_name P_time priority w_time


eee 1 1 0
ddd 5 2 1
ccc 2 3 6
bbb 3 4 8
aaa 4 5 11

total waiting time=26


avg waiting time=5.20

Experiment -7

Experiment Objective:-C program for Round Robin CPU Scheduling Algorithm

Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating


system algorithm
Program Code:-
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<string.h>
void main()
{
char p[10][5];
int et[10],wt[10],timer=3,count,pt[10],rt,i,j,totwt=0,t,n=5,found=0,m;
float avgwt;
clrscr();
for(i=0;i<n;i++)
{
printf("enter the process name : ");

Page no. 16 of KCS451 Lab Manual


scanf("%s",&p[i]);
printf("enter the processing time : ");
scanf("%d",&pt[i]);
}
m=n;
wt[0]=0;
i=0;
do
{
if(pt[i]>timer)
{
rt=pt[i]-timer;
strcpy(p[n],p[i]);
pt[n]=rt;
et[i]=timer;
n++;
}
else
{
et[i]=pt[i];
}
i++;
wt[i]=wt[i-1]+et[i-1];
}while(i<n);

count=0;
for(i=0;i<m;i++)
{
for(j=i+1;j<=n;j++)
{
if(strcmp(p[i],p[j])==0)
{
count++;
found=j;
}
}
if(found!=0)
{

wt[i]=wt[found]-(count*timer);
count=0;
found=0;
}
}
for(i=0;i<m;i++)
{
totwt+=wt[i];
}
avgwt=(float)totwt/m;
for(i=0;i<m;i++)
{
printf("\n%s\t%d\t%d",p[i],pt[i],wt[i]);
}
printf("\ntotal waiting time %d\n",totwt);
printf("total avgtime %f",avgwt);

Page no. 17 of KCS451 Lab Manual


}

Program Output :
enter the process name : aaa
enter the processing time : 4
enter the process name : bbb
enter the processing time : 3
enter the process name : ccc
enter the processing time : 2
enter the process name : ddd
enter the processing time : 5
enter the process name : eee
enter the processing time : 1

p_name p_time w_time


aaa 4 9
bbb 3 3
ccc 2 6
ddd 5 10
eee 1 11

total waiting time : 39


average waiting time : 7.8000

Page no. 18 of KCS451 Lab Manual


Experiment-8
Experiment Objective:- Multi Level Queue Scheduling

Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm

Program Code:
/*Write a C program to simulate multi-level queue scheduling algorithm considering the
following scenario. All the processes in the system are divided into two categories -
system processes and user processes. System processes are to be given higher priority
than user processes. The priority of each process ranges from 1 to 3.
Use fixed priority scheduling for all the processes.*/

#include<stdio.h>
#include<stdlib.h>
main()
{
int p[30],bt[30], su[30], wt[30],tat[30],i, k, n, temp;
float waiting_avg, turnaround_avg;
int tr;
int csource=0;
int cuser=0;
int btsource[30],btuser[30],puser[30],psource[30];
printf("Enter the number of processes : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("System process/User Process (0/1) : ");
scanf("%d", &tr);
printf("Enter the Burst Time of Process %d : ", i);
if(tr==1){
scanf("%d",&btuser[cuser]);
puser[cuser]=i;
cuser++;
}
else if(tr==0){
scanf("%d",&btsource[csource]);
psource[csource]=i;
csource++;
}
}
for(i=0;i<csource;i++){
p[i]=psource[i];
bt[i]=btsource[i];
su[i]=0;

Page no. 19 of KCS451 Lab Manual


}
for(i=0;i<cuser;i++){
p[i+csource]=puser[i];
bt[i+csource]=btuser[i];
su[i+csource]=1;
}
for(i=0;i<n;i++){
printf("%d %d",p[i],bt[i]);

}
waiting_avg = wt[0] = 0;
turnaround_avg = tat[0] = bt[0];
for(i=1;i<n;i++)
{
wt[i] = wt[i-1] + bt[i-1];
tat[i] = tat[i-1] + bt[i];
waiting_avg = waiting_avg + wt[i];
turnaround_avg = turnaround_avg + tat[i];
}
printf("\nPROCESS\t SYSTEM/USER PROCESS \tBURST TIME\tWAITING TIME\tTURNAROUND TIME");
for(i=0;i<n;i++)
printf("\n%d \t\t %d \t\t %d \t\t %d \t\t %d ",p[i],su[i],bt[i],wt[i],tat[i]);
printf("\nAverage Waiting Time is : %f",waiting_avg/n);
printf("\nAverage Turnaround Time is :%f\n",turnaround_avg/n);

}
Output
/tmp/V1OrAZNYcG.o
Enter the number of processes : 5
System process/User Process (0/1) : 0
Enter the Burst Time of Process 0 : 5
System process/User Process (0/1) : 0
Enter the Burst Time of Process 1 : 3
System process/User Process (0/1) : 1
Enter the Burst Time of Process 2 : 8
System process/User Process (0/1) : 1
Enter the Burst Time of Process 3 : 4
System process/User Process (0/1) : 1
Enter the Burst Time of Process 4 : 5
0513283445
PROCESS SYSTEM/USER PROCESS BURST TIME WAITING TIME TURNAROUND TIME
0 0 5 0 5
1 0 3 5 8
2 1 8 8 16
3 1 4 16 20
4 1 5 20 25
Average Waiting Time is : 9.800000
Average Turnaround Time is :14.800000

Experiment-9

Experiment Objective:-Program for FIFO page replacement algorithm

Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm

Page no. 20 of KCS451 Lab Manual


Program Code:-

#include<stdio.h>
#include<conio.h>
intfr[3];
void main()
{
void display();
inti,j,page[12]={2,3,2,1,5,2,4,5,3,2,5,2};
int flag1=0,flag2=0,pf=0,frsize=3,top=0;
clrscr();
for(i=0;i<3;i++)
{
fr[i]=-1;
}
for(j=0;j<12;j++)
{
flag1=0;
flag2=0;
for(i=0;i<12;i++)
{
if(fr[i]==page[j])
{
flag1=1;
flag2=1;
break;
}
}
if(flag1==0)
{
for(i=0;i<frsize;i++)
{
if(fr[i]==-1)
{
fr[i]=page[j];
flag2=1;
break;
}
}
}
if(flag2==0)
{
fr[top]=page[j];
top++;
pf++;
if(top>=frsize)
top=0;
}
display();
}
printf("Number of page faults : %d ",pf);
getch();
}

Page no. 21 of KCS451 Lab Manual


void display()
{
inti;
printf("\n");
for(i=0;i<3;i++)
printf("%d\t",fr[i]);
}

Program Output :
2 -1 -1
2 3 -1
2 3 -1
2 3 1
5 3 1
5 2 1
5 2 4
5 2 4
3 2 4
3 2 4
3 5 4
3 5 2

Number of page faults: 6

Experiment -10

Experiment Objective:-C program for LRU page replacement algorithm

Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm

Program Code:-

#include<stdio.h>
#include<conio.h>
intfr[3];
void main()
{
void display();
int p[12]={2,3,2,1,5,2,4,5,3,2,5,2},i,j,fs[3];
intindex,k,l,flag1=0,flag2=0,pf=0,frsize=3;

Page no. 22 of KCS451 Lab Manual


clrscr();
for(i=0;i<3;i++)
{
fr[i]=-1;
}
for(j=0;j<12;j++)
{
flag1=0,flag2=0;
for(i=0;i<3;i++)
{
if(fr[i]==p[j])
{
flag1=1;
flag2=1;
break;
}
}
if(flag1==0)
{
for(i=0;i<3;i++)
{
if(fr[i]==-1)
{
fr[i]=p[j];
flag2=1;
break;
}
}
}
if(flag2==0)
{
for(i=0;i<3;i++)
fs[i]=0;
for(k=j-1,l=1;l<=frsize-1;l++,k--)
{
for(i=0;i<3;i++)
{
if(fr[i]==p[k])
fs[i]=1;
}
}
for(i=0;i<3;i++)
{
if(fs[i]==0)
index=i;
}
fr[index]=p[j];
pf++;
}
display();
}
printf("\n no of page faults :%d",pf);
getch();
}
void display()

Page no. 23 of KCS451 Lab Manual


{
inti;
printf("\n");
for(i=0;i<3;i++)
printf("\t%d",fr[i]);
}

Program Output :
2 -1 -1
2 3 -1
2 3 -1
2 3 1
2 5 1
2 5 1
2 5 4
2 5 4
3 5 4
3 5 2
3 5 2
3 5 2
no of page faults : 4

Page no. 24 of KCS451 Lab Manual


Experiment-11

Program Objective:-Simulation of Paging technique of Memory Management

Program Prerequisite:- Basic knowledge of C programming and Concept of related Operating system algorithm
Program Code:-
#include<stdio.h>
#include<conio.h>
int main()
{
int page[10], pagetab[10], pframe[2][2], I,j;
int size, msize, cnt, t,k,pos,logadd,m=0;
intframeno;
long int l;
int i;
printf("\nEnter the memory size:");
scanf("%d", &msize);
printf("Enter the pase size:");
scanf("%d", &size);
cnt=(msize/size);
printf("\nEnter the logical page: ");
for(j=0;j
{
scanf("%d", &lpage[j]);
}
t=0;
k=0;
for(j=0;j
{
printf("\n");
if(t
{
printf("%d value is %d\n", t,lpage[j]);
t++;
}
else
{
t=0;
printf("%d value is %d\n", t,lpage[j]);
t++;
}
}
printf("\nEnter the page table value: ");
for(i=0;i
{
scanf("%d", &pagetab[i]);
}
printf("\nEnter the logical address: ");
scanf("%d", &logadd);
for(k=0;k
{
if(logadd==lpage[k])
{
pos=(k/size);
m=k%size;

Page no. 25 of KCS451 Lab Manual


break;
}
else
continue;
}
printf("\nPage number : %d", pos);
frameno=pagetab[pos];
printf("\nThe frame number is %d\n", frameno);
printf("\nThe corresponding physical address is %d", (frameno*size)+m);
}

Program Output:
Enter the memory size:4
Enter the page size:2
Enter the logical page: 2
3
4
5
0 value is 2
1 value is 3
0 value is 4
1 value is 5
Enter the page table value: 101
102
Enter the logical address: 5
Page number : 1
The frame number is 102
The corresponding physical address is 205

Experiment 12
Objective :Calculation of external and internal fragmentation i. Free space list of blocks from system ii. List
process file from the system

MUTIPROGRAMMING VARIABLE TASK

To program MVT using c programming

ALGORITHM:

Step 1: Declare the necessary variables.

Step 2: Get the memory capacity and number of processes. Step 3: Get the memory required for each process.
Step 4: If the needed memory is available for the particular process it will be allocated and the remaining memory
availability will be calculated.
Step 5: If not it has to tell no further memory remaining and the process will not be allocated with memory.

Page no. 26 of KCS451 Lab Manual


Step 6: Then the external fragmentation of each process must be calculated.

SOURCE CODE:
#include<stdio.h> #include<conio.h> void main()
{
int m=0,m1=0,m2=0,p,count=0,i; clrscr();
printf("enter the memory capacity:"); scanf("%d",&m); printf("enter the no of processes:"); scanf("%d",&p);
for(i=0;i<p;i++)
{
printf("\nenter memory req for process%d: ",i+1); scanf("%d",&m1); count=count+m1;
if(m1<=m)
{
if(count==m)
printf("there is no further memory remaining:");
printf("the memory allocated for process%d is: %d ",i+1,m);m2=m-m1; printf("\nremaining memory is: %d",m2);
m=m2;
}
}
else
{
printf("memory is not allocated for process%d",i+1);
}
printf("\nexternal fragmentation for this process is:%d",m2);
}
getch();
}

SAMPLE INPUT AND OUTPUT:


Input:
Enter the memory capacity: 80 Enter no of processes: 2
Enter memory req for process1: 23
Output:
The memory allocated for process1 is: 80 Remaining memory is: 57
External fragmentation for this process is: 57 Enter memory req for process2: 52
The memory allocated for process2 is: 57 Remaining memory is: 5
External fragmentation for this process is: 5

MUTIPROGRAMMING FIXED TASK


OBJECTIVE: To program MFT using c programming

ALGORITHM:

Step 1: Declare the necessary variables.

Step 2: Get the memory capacity and number of processes.

Step 3: calculate the number of partitions the total memory has to be divided.

Step 4: Get the required memory for each process if the required memory is available in that particular partition the
process will be allocated to that partition and the internal fragmentation will be calculated.

Page no. 27 of KCS451 Lab Manual


Step 5: If the required memory not available then the process will not be allocated to that partition.
Step 6: Calculate the external fragmentation and total number of fragmentation.

SOURCE CODE:

#include<stdio.h>
#include<conio.h>
int main()
{
int m,p,s,p1;
int m1[4],i,f,f1=0,f2=0,fra1,fra2,s1,pos; clrscr();
printf("Enter the memory size:");
scanf("%d",&m);
printf("Enter the no of partitions:");
scanf("%d",&p); s=m/p;
printf("Each partn size is:%d",s);
printf("\nEnter the no of processes:");
scanf("%d",&p1); pos=m;
for(i=0;i<p1;i++)
{
if(pos<s)
{
printf("\nThere is no further memory for process%d",i+1); m1[i]=0; break;
}
else
{
printf("\nEnter the memory req for process%d:",i+1); scanf("%d",&m1[i]); if(m1[i]<=s)
{
printf("\nProcess is allocated in partition%d",i+1); fra1=s-m1[i]; printf("\nInternal fragmentation for process is:
%d",fra1); f1=f1+fra1; pos=pos-s;

}
else
{
printf("\nProcess not allocated in partition%d",i+1); s1=m1[i]; while(s1>s)
{
s1=s1-s;pos=pos-s;
}
pos=pos-s;fra2=s-s1;f2=f2+fra2;
printf("\nExternal Fragmentation for this process is:%d",fra2);
}
}
}

printf("\nProcess\tallocatedmemory");
for(i=0;i<p1;i++)
printf("\n%5d\t%5d",i+1,m1[i]);
f=f1+f2;
printf("\nThe tot no of fragmentation is:%d",f); getch(); return 0;
}

SAMPLE INPUT AND OUTPUT:


Input:
Enter the memory size: 80 Enter the no of partitions: 4 Each partition size: 20
Enter the number of processes: 2 Enter the memory req for process1: 18

Page no. 28 of KCS451 Lab Manual


Output:
Process1 is allocated in partn1
Internal fragmentation for process1 is: 2 Enter the memory req for process2: 22 Process2 is not allocated in partn2
External fragmentation for process2 is: 18

Process memory allocated


1 20 18
2 20 22
The tot no of fragmentation is: 20

Page no. 29 of KCS451 Lab Manual


Experiment :13
Implement file storage allocation technique: i. Contiguous(using array) ii. Linked –list(using linked-list) iii.
Indirect allocation (indexing)

OBJECTIVE: To implement sequential file allocation technique.

Page no. 30 of KCS451 Lab Manual


ALGORITHM:

Step 1: Start the program.

Step 2: Get the number of files.

Step 3: Get the memory requirement of each file.

Step 4: Allocate the required locations to each in sequential order.

a). Randomly select a location from available location s1= random(100); b). Check

whether the required locations are free from the selected location. c). Allocate and set

flag=1 to the allocated locations.

Step 5: Print the results fileno, length , Blocks allocated. Step 6:

Stop the program.

SOURCE CODE:
#include<stdio.h>
main()
{
int f[50],i,st,j,len,c,k;
clrscr(); for(i=0;i<50;i+
+) f[i]=0;
X:
printf("\n Enter the starting block & length of file");
scanf("%d%d",&st,&len);
for(j=st;j<(st+len);j++)
if(f[j]==0)
{ f[j]=1
;
printf("\n%d->%d",j,f[j]);
}
else
{
printf("Block already allocated"); break;
}
if(j==(st+len))
printf("\n the file is allocated to disk");
printf("\n if u want to enter more files?(y-1/n-0)");
scanf("%d",&c);
if(c==1)
goto X;
else
exit();
getch();

Page no. 31 of KCS451 Lab Manual


}

Output:
Enter the starting block & length of file 4 10

4->1
5->1
6->1
7->1
8->1
9->1
10->1
11->1
12->1
13->1
The file is allocated to disk
If you want to enter more files? (Y-1/N-0)

LINKED FILE ALLOCATION


OBJECTIVE:

To write a C program to implement File Allocation concept using the technique Linked List Technique.

ALGORITHM:

Step 1: Start the Program

Step 2: Get the number of files.

Step 3: Allocate the required locations by selecting a location randomly Step 4:

Check whether the selected location is free.

Step 5: If the location is free allocate and set flag =1 to the allocated locations. Step 6: Print

the results file no, length, blocks allocated.

Step 7: Stop the execution


SOURCE CODE:
#include<stdio.h>
main()
{
int f[50],p,i,j,k,a,st,len,n,c;
clrscr();
for(i=0;i<50;i++)
f[i]=0;
printf("Enter how many blocks that are already allocated");

Page no. 32 of KCS451 Lab Manual


scanf("%d",&p);
printf("\nEnter the blocks no.s that are already allocated");
for(i=0;i<p;i++)
{
scanf("%d",&a);
f[a]=1;
}
X:
printf("Enter the starting index block & length");
scanf("%d%d",&st,&len);
k=len;
for(j=st;j<(k+st);j++)
{
if(f[j]==0)
{ f[j]=1
;
printf("\n%d->%d",j,f[j]);
}
else
{
printf("\n %d->file is already allocated",j); k++;
}
}
printf("\n If u want to enter one more file? (yes-1/no-0)");
scanf("%d",&c);
if(c==1)
goto X;
else
exit();
getch( );}

Page no. 33 of KCS451 Lab Manual


OUTPUT:
Enter how many blocks are already allocated 3
Enter the blocks no’s that are already allocated 4 7 9 Enter the
starting index block & length 3
7
3-> 1
4-> File is already allocated 5->1
6->1
7-> File is already allocated 8->1
9-> File is already allocated 10-
>1
11->1
12->1
If u want to enter one more file? (yes-1/no-0)

INDEXED FILE ALLOCATION

OBJECTIVE:

To write a C program to implement File Allocation concept using the technique indexed allocation

Technique

ALGORITHM:

Step 1: Start the Program

Step 2: Get the number of files.

Step 3: Get the memory requirement of each file.

Step 4: Allocate the required locations by selecting a location randomly. Step 5: Print

the results file no,length, blocks allocated.

Step 7: Stop the execution.

Page no. 34 of KCS451 Lab Manual


SOURCE CODE:

#include<stdio.h>
int f[50],i,k,j,inde[50],n,c,count=0,p; main()
{
clrscr();
for(i=0;i<50;i++)
f[i]=0;
x:
printf("enter index block\t");
scanf("%d",&p);
if(f[p]==0)
{ f[p]=1
;
printf("enter no of files on index\t");
scanf("%d",&n);
}
else
{
printf("Block already allocated\n"); goto
x;
}
for(i=0;i<n;i++)
scanf("%d",&inde[i]);
for(i=0;i<n;i++)
if(f[inde[i]]==1)
{
printf("Block already allocated"); goto
x;
}
for(j=0;j<n;j++)
f[inde[j]]=1; printf("\n
allocated");
printf("\n file indexed");
for(k=0;k<n;k++)
printf("\n %d->%d:%d",p,inde[k],f[inde[k]]); printf(" Enter 1
to enter more files and 0 to exit\t"); scanf("%d",&c);
if(c==1)
goto x;
else
exit();
getch();

Page no. 35 of KCS451 Lab Manual


}

OUTPUT:

Enter index block 9


Enter no of files on index 3
123
Allocated File
indexed 9->
1:1
9-> 2:1
9->3:1
Enter 1 to enter more files and 0 to exit

Experiment 14 : SIMULATE BANKERS ALGORITHM FOR DEADLOCK AVOIDANCE

OBJECTIVE:

To write a C program to implement bankers algorithm for dead lock avoidance

Page no. 36 of KCS451 Lab Manual


ALGORITHM:

Step 1: Start the Program

Step 2: Get the values of resources and processes. Step 3:

Get the avail value.

Step 4: After allocation find the need value.

Step 5: Check whether its possible to allocate. If possible it is safe state

Step 6: If the new request comes then check that the system is in safety or not if we allow the request.

Step 7: Stop the execution

Page no. 37 of KCS451 Lab Manual


SOURCE CO DE:

#include<stdio..h>
#include<conio h>
void main()
{
int n,r,i,j,k,p,u=0,s=0,m;
int block[10],run[10],active[10],newreq[10];
int max[10][10],resalloc[10][10],resreq[10][1]; int totalloc[10],totext[10],simalloc[10];
clrscr();
printf("Enter the no of processes:"); scanf("%d",&n);
printf("Enter the no of resource classes:"); scanf("%d",&r);
printf("Enter the total existed resource in each class:"); for(k=1;k<=r;k++)
scanf("%d",&totext[k]);
printf("Enter the allocated resources:");
for(i=1;i<=n;i++)
for(k=1;k<=r;k++)
scanf("%d",&resallc);
printf("Enter the process making the new request:");
scanf("%d",&p);
printf("Enter the requested resource:");
for(k=1;k<=r;k++) scanf("%d",&newreq[k]);
printf("Enter the process which are n blocked or running:");
for(i=1;i<=n;i++)
{
if(i!=p)
{
printf("process %d:\n",i+1); scanf("%d%d",&block[i],&run[i]);
}}
block[p]=0; run[p]=0; for(k=1;k<=r;k)
{ j=0;
for(i=1;i<=n;i++) { totalloc[k]=j+resalloc[i][k]; j=totalloc[k];
}}
for(i=1;i<=n;i++)
{
if(block[i]==1||run[i]==1) active[i]=1;
else active[i]=0;
}
for(k=1;k<=r;k++)
{
resalloc[p][k]+=newreq[k]; totalloc[k]+=newreq[k];
}
for(k=1;k<=r;k++)
{
if(totext[k]-totalloc[k]<=r;k++)
simalloc[k]=totalloc[k];
for(s=1;s<=n;s++)
for(i=1;i<=n;i++)
{
if(active[i]==1)
{
j=0;

Page no. 38 of KCS451 Lab Manual


for(k=1;k<=r;k++)
{
if((totext[k]-simalloc[k])<(max[i][k]-resalloc[i][k]))
{
J=1;
break;
}}}
if(j==0)
{
active[i]=0; for(k=1;k<=r;k++) simalloc[k]=resalloc[i][k];
} } m=0;
for(k=1;k<=r;k++) resreq[p][k]=newreq[k]; printf("Deadlock willn't occur");
}
Else
{
for(k=1;k<=r;k++)
{
resalloc[p][k]=newreq[k];
totalloc[k]=newreq[k];
}
printf("Deadlock will occur");
}
getch();
}

OUTPUT:
Enter the no of resources: 4
Enter the no of resource classes: 3
Enter the total existed resources in each class: 3 2 2 Enter the allocated resources: 1 0 0 5 1 1 2 1 1 0 0 2 Enter the
process making the new request: 2
Enter the requested resource: 1 1 2
Enter the processes which are n blocked or running: Process 1: 1 2 Process 3: 1 0
Process 4: 1 0 Deadlock will occur

Sample question for Viva-Voce

1. Briefly explain FCFS.


FCFS is short for First-come, first-served, and is one type of scheduling algorithm. In this scheme, the process that
requests the CPU first is allocated the CPU first. Implementation is managed by a FIFO queue.

2. What are turnaround time and response time?


Turnaround time is the interval between the submission of a job and its completion. Response time is the interval
between submission of a request, and the first response to that request.

3. If the quantum time of round robin algorithm is very large, then it is equivalent to:
(A) First in first out
(B) Shortest Job Next
(C) Lottery scheduling

Page no. 39 of KCS451 Lab Manual


(D) None of the above
Answer: (A)

4. Which of the following scheduling algorithms is non-preemptive?


(A) Round Robin
(B) First-In First-Out
(C) Multilevel Queue Scheduling
(D) Multilevel Queue Scheduling with Feedback
Answer: (B)
5. The scheduling in which CPU is allocated to the process with least CPU-burst time is called
(A) Priority Scheduling (B) Shortest job first Scheduling (C) Round Robin Scheduling (D) Multilevel Queue
Scheduling
Ans: (B)
6. Differentiate between pre-emptive and non-pre-emptive scheduling.
Ans: In a pre-emptive scheduling approach, CPU can be taken away from a process if there is a need while in a non-
pre-emptive approach if once a process has been given the CPU, the CPU cannot be taken away from that process,
unless the process completes or leaves the CPU for performing an Input Output. DC14 System Software and
Operating System 15 Pre-emptive scheduling is more useful in high priority process which requires immediate
response, for example in real time system. While in nonpreemptive systems, jobs are made to wait by longer jobs,
but treatment of all processes is fairer.
7. Which of the following process scheduling algorithm may lead to starvation
(A) FIFO
(B) Round Robin
(C) Shortest Job Next
(D) None of the above
Answer: (C)

Explanation: Shortest job next may lead to process starvation for processes which will require a long time to
complete if short processes are continually added.
8. Which of the following process scheduling algorithm may lead to starvation
(A) FIFO
(B) Round Robin
(C) Shortest Job Next
(D) None of the above
Answer: (C)
Explanation: Shortest job next may lead to process starvation for processes which will require a long time to
complete if short processes are continually added.
9. Consider three CPU-intensive processes, which require 10, 20 and 30 time units and arrive at times 0, 2 and 6,
respectively. How many context switches are needed if the operating system implements a shortest remaining time
first scheduling algorithm? Do not count the context switches at time zero and at the end.
(A) 1
(B) 2
(C) 3
(D) 4
Answer: (B)

11. what do you understand by priority scheduling.

Page no. 40 of KCS451 Lab Manual


Processes scheduling in which the scheduler selects tasks to run based on their priority as opposed to, say, a simple
round-robin. Priorities may be static or dynamic. Static priorities are assigned at the time of creation, while dynamic
priorities are based on the processes' behaviour while in the system.

12. difference between priority and SJF scheduling algorithm


A priority number (integer) is associated with each process, The CPU is allocated to the process with the
highest priority (smallest integer ≡ highest priority).
1. Preemptive
2. nonpreemptive
SJF is a priority scheduling where priority is the predicted next CPU burst time.
Problem ≡ Starvation – low priority processes may never execute.
Solution ≡ Aging – as time progresses increase the priority of the process.

13. What is concept of RR Scheduling.


Round-robin:-round-robin policy is a method in which every process gets its time slice. after executing a process for
certain time slice..if the job is not completed in that time it will be thrown into waiting state and the next job gets the
timeslice and will be executed..and the process that was in waiting state will get processor time after the remaining
processes are completed.
14. Which of the following statements are true?
I. Shortest remaining time first scheduling may cause starvation
II. Preemptive scheduling may cause starvation
III. Round robin is better than FCFS in terms of response time
(A) I only
(B) I and III only
(C) II and III only
(D) I, II and III
Answer: (D)
15. What is basic idea behind LRU
A good approximation to the optimal algorithm is based on the observation that pages that have been heavily used in
the last few instructions will probably be heavily used again in the next few. Conversely, pages that have not been
used for ages will probably remain unused for a long time. This idea suggests a realizable algorithm: when a page
fault occurs, throw out the page that has been unused for the longest time. This strategy is called LRU (Least
Recently Used) paging.

16. What is problem related to LRU


To fully implement LRU, it is necessary to maintain a linked list of all pages in memory, with the most recently used
page at the front and the least recently used page at the rear. The difficulty is that the list must be updated on every
memory reference. Finding a page in the list, deleting it, and then moving it to the front is a very time consuming
operation, even in hardware (assuming that such hardware could be built).

17. Difference between FIFO and LRU


Answer: FIFO stands for First In First Out. There is less overhead because there is no need to keep track of the
pages. However this is not necessarily efficient because more frequently used pages can still be removed because
was the first in.
18. What are local and global page replacements?

Page no. 41 of KCS451 Lab Manual


Local replacement means that an incoming page is brought in only to the relevant process address space. Global
replacement policy allows any page frame from any process to be replaced. The latter is applicable to variable
partitions model only.

19. Physical memory is broken into fixed-sized blocks called ________.


a) frames
b) pages
c) backing store
d) None of these
Answer: a

20. Logical memory is broken into blocks of the same size called _________.
a) frames
b) pages
c) backing store
d) None of these
Answer: b

21. Every address generated by the CPU is divided into two parts : (choose two)
a) frame bit
b) page number
c) page offset
d) frame offset
Answer: b and c

22. The _____ table contains the base address of each page in physical memory.
a) process
b) memory
c) page
d) frame
Answer: c

Page no. 42 of KCS451 Lab Manual

You might also like