Osy Qb Ans [Final]
Osy Qb Ans [Final]
Osy Qb Ans [Final]
The system simulates resource allocation for each request to determine if it can
be safely granted without leading to an unsafe state.
Chapter no 5: Memory Management
Q.1 Describe paging and segmentation
Paging
▪ Number of partitions in memory are fixed but size of each partition may
or may not be same.
▪ As it is contiguous allocation, hence no spanning is allowed.
▪ Partition is made before execution or during system configure
▪ simplest technique used to put more than one processes in the main
memory
Advantages:
▪ Easy to implement
▪ Little OS overhead
Disadvantages:
▪ Internal Fragmentation
▪ External Fragmentation
▪ Limited process size
▪ Limitation on Degree of Multiprogramming
Variable partitioning
▪ Initially main memory is empty and partitions are made during the run-
time according to process’s need instead of partitioning during system
configure
▪ The size of partition will be equal to incoming process
▪ Internal fragmentation can be avoided to ensure efficient utilisation of
memory
▪ Number of partitions are not fixed and depends on the number of
incoming process and Main Memory’s size
Advantages:
▪ No Internal Fragmentation
▪ No restriction on Degree of Multiprogramming
▪ No Limitation on the size of the process
Disadvantages:
▪ Difficult Implementation
▪ External Fragmentation
Q.3 Numerical based on Page replacement algorithms.
FIFIO (Other Name of Page Replacement Algorithm):
Q.4 Define: i)Page fault
ii)Virtual Memory
iii)Locality of reference
i) Page Fault:
• A page fault is trap that occurs when the requested page is not loaded
into the memory
• When a program tries to access a chunk of memory that does not exist in
physical memory (main memory) causes a page fault.
• The bit can take two values: 0 and 1: 0 indicates that the block is free
and 1 indicates an allocated block.
• Finding the first free block is efficient. It requires scanning the words (a
group of 8 bits) in a bitmap for a non-zero word. (A 0-valued word has all
bits 0). The first free block is then found by scanning for the first 1 bit in
the non-zero word.
Disadvantages:
• For finding a free block, Operating System needs to iterate all the blocks
which is time consuming.
Linked List:
• In this approach, the free disk blocks are linked together i.e. a free block
contains a pointer to the next free block.
• The block number of the very first disk block is stored at a separate
location on disk and is also cached in memory.
• The last free block would contain a null pointer indicating the end of free
list.
Advantages:
• The total available space is used efficiently using this method.
• Dynamic allocation in Linked List is easy, thus can add the space as
per the requirement dynamically.
Disadvantages:
• When the size of Linked List increases, managing the pointers becomes
tedious
Chapter no 6.: File Management
Q.1 Explain any four file operations
1.Create
Creation of the file is the most important operation on the file. Different types
of files are created by different methods for example text editors are used to
create a text file, word processors are used to create a word file and Image
editors are used to create the image files.
2.Write
Writing the file is different from creating the file. The OS maintains a write
pointer for every file which points to the position in the file from which, the
data needs to be written.
3.Read
Every file is opened in three different modes : Read, Write and append. A Read
pointer is maintained by the OS, pointing to the position up to which, the data
has been read.
4.Re-position
Re-positioning is simply moving the file pointers forward or backward
depending upon the user's requirement. It is also called as seeking.
5.Delete
Deleting the file will not only delete all the data stored inside the file, It also
deletes all the attributes of the file. The space which is allocated to the file will
now become available and can be allocated to the other files.
6.Truncate
Truncating is simply deleting the file except deleting attributes. The file is not
completely deleted although the information stored inside the file get
replaced.
Q.2 Write a note on RAID.
• RAID works by placing data on multiple disks and allowing input/output
(I/O) operations to overlap in a balanced way, improving performance.
• Because using multiple disks increases the mean time between failures,
storing data redundantly also increases fault tolerance.
• RAID arrays appear to the operating system (OS) as a single logical drive.
RAID 0:
• Data is distributed across the HDDs in the RAID set.
• Does not provide data protection and availability in the event of disk
failures.
RAID 1:
• Data is stored on two different HDDs, yielding two copies of the same
data.
• In the event of HDD failure, access to data is still available from the
surviving HDD.
• When the failed disk is replaced with a new one, data is automatically
copied from the surviving disk to the new disk.
RAID 3 & 4:
• Stripes data for high performance and uses parity for improved
fault tolerance.
• For RAID 3, data read / write is done across the entire stripe.
▪ Provide good bandwidth for large sequential data
access such as video streaming.
o The probability for this to happen increases and the number of drives in
the array increases.
• CHAINED/LINKED ALLOCATION
• In this scheme, each file is a linked list of disk blocks which need not
be contiguous.
• The disk blocks can be scattered anywhere on the disk
• The directory entry contains a pointer to the starting and the ending file
block
• Each block contains a pointer to the next block occupied by the file
ii) Indexed Allocation:
• In this scheme, a special block known as the Index block contains the
pointers to all the blocks occupied by a file.
• Each file has its own index block.
• The ith entry in the index block contains the disk address of the ith file
block.
• The directory entry contains the address of the index block
Q.4 Explain directory structure.
1. Single-level directory:
• The simplest method is to have one big list of all the files on the disk. The
entire system will contain only one directory which is supposed to
mention all the files present in the file system. The directory contains
one entry per each file present on the file system.
Advantages:
•Since it is a single directory, so its implementation is very easy.
• If files are smaller in size, searching will faster.
• The operations like file creation, searching, deletion, updating are very easy
in such a directory structure.
Disadvantages:
• There may chance of name collision because two files can not have the same
name.
• Searching will become time taking if directory will large.
• In this can not group the same type of files together.
2. Two-level directory:
Advantages:
• We can give full path like /User-name/directory-name/.
• Different users can have same directory as well as file name.
• Searching of files become more easy due to path name and user-
grouping.
Disadvantages:
• A user is not allowed to share files with other users.
• Still it not very scalable
• two files of the same type cannot be grouped together in the same user.
3. Tree-structured directory:
• In Tree structured directory system, any directory entry can either be a
file or sub directory.
• Root directory contains all directories for each user
• The users can create subdirectories and even store files in their directory
• A user do not have access to root directory and cannot modify it
Advantages:
• Very generalize, since full path name can be given.
• Very scalable, the probability of name collision is less.
• Searching becomes very easy, we can use both absolute path as well as
relative.
Disadvantages:
• Every file does not fit into the hierarchical model, files may be saved into
multiple
directories.
• We can not share files.
• It is inefficient, because accessing a file may go under multiple directories.