IA3 Question Bank & Answers
IA3 Question Bank & Answers
Q.No.02. With the supporting diagram explain the steps involved in handling page fault.
Steps in Handling a Page Fault
1. The memory address requested is first checked, to make sure it was a valid memory request.
2. If the reference is to an invalid page, the process is terminated. Otherwise, if the page is not
present in memory, it must be paged in.
3. A free frame is located, possibly from a free-frame list.
4. A disk operation is scheduled to bring in the necessary page from disk.
5. After the page is loaded to memory, the process's page table is updated with the new frame
number, and the invalid bit is changed to indicate that this is now a valid page reference.
6. The instruction that caused the page fault must now be restarted from the beginning.
In any case, we are faced with three major components of the page-fault service time:
1. Service the page-fault interrupt.
2.Read in the page.
3. Restart the process.
• The first and third tasks can be reduced, with careful coding, to several hundred
instructions.
• Consider: - average page-fault service time : 8 milliseconds , memory-access time :
200 nanoseconds, the effective access time in nanoseconds is effective access time
EAT = (1 - p) x (200) + p (8 milliseconds)
= (1 - p) x 200 + p x 8,000,000
= 200 + 7,999,800 x p
• the effective access time is directly proportional to the page-fault rate.
Q.No.4. For the following page reference string 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1
Calculate no of page faults using FIFO, Optimal page replacement and LRU
FIFO: A FIFO replacement algorithm associates each page the time when that page was brought
into memory. when a Page is to be replaced the oldest one is selected.
Optimal Page Replacement: “Replace the page that will not be used for the longest period of
time”
Least Recently Used: The LRU (Least Recently Used) algorithm, predicts that the page that has not
been used in the longest time is the one that will not be used again in the near future.
Q.No.05. What is file? Explain the various file operations and attributes.
A file is a named collection of related information that is recorded on secondary storage. The
information in a file is defined by its creator. Many different types of information may be stored in a
file source programs, object programs, executable programs, numeric data, text, payroll records,
graphic images, sound recordings, and so on.
A file's attributes vary from one operating system to another but typically consist of these:
Name: The symbolic file name is the only information kept in human readable form.
Identifier: This unique tag, usually a number, identifies the file within the file system; it is the non-
human-readable name for the file.
Type: This information is needed for systems that support different types of files.
Location: This information is a pointer to a device and to the location of the file on that device.
Size: The current size of the file (in bytes, words, or blocks) and possibly the maximum allowed size
are included in this attribute.
Protection: Access-control information determines who can do reading, writing, executing, and so
on.
Time, date, and user identification: This information may be kept for creation, last modification,
and last use. These data can be useful for protection, security, and usage monitoring.
File Operations
A file is an abstract data type. To define a file properly, we need to consider the operations that can
be performed on files.
Reading a file:To read from a file, we use a system call that specifies the name of the file and where
the next block of the file should be put. Again, the directory is searched for the associated entry, and
the system needs to keep a read pointer to the location in the file where the next read is to take place.
Once the read has taken place, the read pointer is updated.
Repositioning within a file:The directory is searched for the appropriate entry, and the current-file-
position pointer is repositioned to a given value. Repositioning within a file need not involve any
actual I/0. This file operation is also known as files seek.
Deleting a file:To delete a file, search the directory for the named file. Having found the associated
directory entry, then release all file space, so that it can be reused by other files, and erase the directory
entry.
Truncating a file:The user may want to erase the contents of a file but keep its attributes. Rather
than forcing the user to delete the file and then recreate it, this function allows all attributes to remain
unchanged but lets the file be reset to length zero and its file space released.
A read operation (next-reads) reads the next portion of the file and automatically advances a file
pointer, which tracks the I/O location
The write operation (write next) appends to the end of the file and advances to the end of the newly
written material.
A file can be reset to the beginning and on some systems, a program may be able to skip forward or
backward n records for some integer n-perhaps only for n =1.
Direct Access
A file is made up of fixed length logical records that allow programs to read and write
records rapidly in no particular order.
The direct-access method is based on a disk model of a file, since disks allow random
access to any file block. For direct access, the file is viewed as a numbered sequence of
blocks or records.
Example: if we may read block 14, then read block 53, and then write block 7. There are no
restrictions on the order of reading or writing for a direct-access file.
Direct-access files are of great use for immediate access to large amounts of information
such as Databases, where searching becomes easy and fast.
1. Single-level Directory
The simplest directory structure is the single-level directory. All files are contained in the
same directory, which is easy to support and understand
A single-level directory has significant limitations, when the number of files increases or
when the system has more than one user.
2. Two-Level Directory
In the two-level directory structure, each user has its own user file directory (UFD). The UFDs have
similar structures, but each lists only the files of a single user.
When a user refers to a particular file, only his own UFD is searched. Different users may have files
with the same name, as long as all the file names within each UFD are unique.
To create a file for a user, the operating system searches only that user's UFD to a scertain whether
another file of that name exists. To delete a file, the operating system confines its search to the local
UFD thus; it cannot accidentally delete another user's file that has the same name.
The tree has a root directory, and every file in the system has a unique path name.
A directory contains a set of files or subdirectories. A directory is simply another file, but it
is treated in a special way.
All directories have the same internal format. One bit in each directory entry defines the
entry as a file (0) or as a subdirectory (1). Special system calls are used to create and delete
directories.
The common subdirectory should be shared. A shared directory or file will exist in the file
system in two or more places at once. A tree structure prohibits the sharing of files or
directories.
An acyclic graph is a graph with no cycles. It allows directories to share subdirectories and
files.
The same file or subdirectory may be in two different directories. The acyclic graph is a
natural generalization of the tree-structured directory scheme.
5.General Graph Directory
At this point, to increases CPU utilization and stop thrashing, we must increase degree of
multiprogramming.
we can limit the effect of thrashing by using a local replacement algorithm. To prevent thrashing,
we must provide a process as many frames as it needs
Locality of Reference:
Locality is caused by loops in code that find to reference arrays and other
data structures by indices.
The ordered list of page number accessed by a program is called reference string
The entry access (i, j) defines the set of operations that a process executing in domain Di can
invoke on object Oj.
In the above diagram, there are four domains and four objects—three files (F1, F2, F3) and one
printer. A process executing in domain D1 can read files F1 and F3. A process executing in
domain D4 has the same privileges as one executing in domain D1; but in addition, it can also
write onto files F1 and F3.
When a user creates a new object Oj, the column Oj is added to the access matrix with the
appropriate initialization entries, as dictated by the creator.
The process executing in one domain and be switched to another domain. When we switch a
process from one domain to another, we are executing an operation (switch) on an object (the
domain).
A capability list for a domain is a list of objects together with the operations allowed
on those objects. An object is often represented by its name or address, called a
capability.
To execute operation M on object Oj, the process executes the operation M, specifying
the capability for object Oj as a parameter. Simple possession of the capability means
that access is allowed.
Capabilities are distinguished from other data in one of two ways:
1. Each object has a tag to denote its type either as a capability or as accessible data.
2. The address space associated with a program can be split into two parts. One part is
accessible to the program and contains the program's normal data and instructions.
The other part, containing the capability list, is accessible only by the operating
system.
4. A Lock-Key Mechanism
The lock-key scheme is a compromise between access lists and capability lists.
Each object has a list of unique bit patterns, called locks. Each domain has a list of
unique bit patterns, called keys.
A process executing in a domain can access an object only if that domain has a key
that matches one of the locks of the object.
Q.No.12. Differentiate between equal and proportional allocation
Q.No.14. Explain the following disk scheduling algorithms also calculate seek time and
disk rotations for the following queue.: 98 183 37 122 14 124 65 67
i) FCFS ii) SSTF iii) SCAN iv) Look
Ans: FCFS
SSTF
SCAN
(LooK refer class notes)
Q.No.16. Describe with a neat diagram the components of Linux operating system
Ans.Components of a Linux System
Linux is composed of three main bodies of code; the most important distinction between the
kernel and all other components.
1. The kernel is responsible for maintaining the important abstractions of the operating
system.
Kernel code executes in kernel mode with full access to all the physical resources of
the computer.
All kernel code and data structures are kept in the same single address space.
2. The system libraries define a standard set of functions through which applications interact
with the kernel, and which implement much of the operating-system functionality that does
not need the full privileges of kernel code.
3. System utilities. The system utilities are programs that perform individual, specialized
management tasks. Some system utilities may be invoked just once to initialize and configure some
aspect of the system. others known as daemons in UNIX terminology may run permanently, handling
such tasks as responding to incoming network connections, accepting logon requests from terminals,
and updating log files.
Figure illustrates the various components that make up a full Linux system.
Module Management
Supports loading modules into memory and letting them talk to the rest of the kernel.
Module loading is split into two separate sections:
Managing sections of module code in kernel memory
Handling symbols that modules are allowed to reference
Driver Registration
Allows modules to tell the rest of the kernel that a new driver has become available.
The kernel maintains dynamic tables of all known drivers, and provides a set of routines to
allow drivers to be added to or removed from these tables at any time.
Registration tables include the following items:
Device drivers
File systems
Network protocols
Binary format
Conflict Resolution
A mechanism that allows different device drivers to reserve hardware resources and to
protect those resources from accidental use by another driver
The conflict resolution module aims to: