OS UNIT 5 DC
OS UNIT 5 DC
Vidyalankar School of
Information Technology
Wadala (E), Mumbai
www.vsit.edu.in
Compiled by: Bhavesh Shah
[email protected]
Certificate
This is to certify that the e-book titled “Operating Systems”
comprises all elementary learning tools for a better
understating of the relevant concepts. This e-book is
comprehensively compiled as per the predefined eight
parameters and guidelines.
Contents:
IO and File Management: I/O Management and Disk Scheduling, File Management, Operating
System Security.
Recommended Books:
1. Operating Systems – Internals and Design Principles Willaim Stallings Pearson 9th edition 2009
2. Operating System Concepts Abraham Silberschatz, Wiley 8th edition
3. Operating Systems Godbole and Kahate McGraw Hill 3rd edition
Online Resources:
• https://onlinecourses.nptel.ac.in/noc20_cs04/preview
• https://free.aicte-india.org/
• https://www.javatpoint.com/best-courses-for-the-operating-system
Prerequisites
Prerequisites Linkage
Unit III Sem. I Sem. II Sem. Sem. IV Sem. V Sem. VI
III
Concurrency Principles Object - Introductio Linux System IT
and Memory of Oriented n to Administratio Service
Programm Programm Embedded n Manage
ing ing with Systems ment
Language C++
Q. Write the categories of I/O DEVICES. List the key differences among them.
• Human readable: Suitable for communicating with the computer user. Examples
include printers and terminals, the latter consisting of video display, keyboard, and
perhaps other devices such as a mouse.
• Machine readable: Suitable for communicating with electronic equipment. Examples are
disk drives, USB keys, sensors, controllers, and actuators.
• Communication: Suitable for communicating with remote devices. Examples are digital
line drivers and modems.
The key differences are the following:
▪ Data rate: There may be differences of several orders of magnitude between the data
transfer rates.
▪ Application: The use to which a device is put has an influence on the software and
policies in the OS and supporting utilities. For example, a disk used for files
requires the support of file management software. A disk used as a backing store for
pages in a virtual memory scheme depends on the use of virtual memory hardware
and software. Furthermore, these applications have an impact on disk scheduling
algorithms (discussed later in this chapter). As another example, a terminal may be
used by an ordinary user or a system administrator. These uses imply different
privilege levels and perhaps different priorities in the OS.
▪ Complexity of control: A printer requires a relatively simple control interface. A
disk is much more complex. The effect of these differences on the OS is filtered to
some extent by the complexity of the I/O module that controls the device, as
discussed in the next section.
▪ Unit of transfer: Data may be transferred as a stream of bytes or characters (e.g.,
terminal I/O) or in larger blocks (e.g., disk I/O).
▪ Data representation: Different data encoding schemes are used by different devices,
including differences in character code and parity conventions.
▪ Error conditions: The nature of errors, the way in which they are reported, their
consequences, and the available range of responses differ widely from one device to
another.
2. Double Buffering
Double buffering is an extended variant of single buffering. In this type buffering, a process
can transfer data to or from one buffer while the operating system removes or fills the other.
Therefore, double buffering has two system buffers instead of one.
3. Circular Buffering
When more than two buffers are used, then it is called circular buffering. It is used to solve
the issues associated with the double buffering technique. Sometimes, the double buffering
becomes insufficient, when the process performs rapid bursts of I/O. In the circular buffer,
each individual buffer acts as a unit.
Input/Output I/O Buffering in Operating System OS Lecture Notes Tutorial Easy by Tanvi Sharma -
YouTube
The RAID 0 technique provides "n" times increase in the data transfer rate, where "n" is the number of dis
The major disadvantage of RAID 0 is that the data cannot be retrieved even if a single disk fails to work.
RAID 1 uses disk mirroring technique, in which the similar data is stored on two separate disks. In RAID
configuration, the data in the similar data that can be accessed in less time is used and a parallel read is a
executed when there is no error. When a record is written/updated by a process, a copy of this record is writ
on each disk every time. Thus, there is always a copy of the record available to access. In this way, RAID
provides mirror protection and improves the fault tolerance.
• It duplicates all the disks, so there are four primary disks and four backup disks. It is ‘data mirroring’
• Two copies of the data are held on two physical disks, and the data is always identical.
• Twice as many disks are required to store the same data.
• Fault tolerance is excellent: if a drive crashes, the copy is simply used instead.
In this level entire set or block of data written onto the data disk and then the parity is
generated and stored on a different set of disk. This level overcome at most one disk
failure. If more than one disk failure occur then there is no way to recover the data. Both
RAID 3 and RAID 4 require at least three disk to implement RAID.
Advantages –
1. It facilitates simultaneous I/O request because of Block striping.
2. Storage overhead is low.
Disadvantages –
1. Parity disk may lead to bottleneck.
2. Slow random writes because of separate block parity.
RAID-5 (Block-Level Stripping with Distributed Parity)
This is a slight modification of the RAID-4 system where the only difference is that
the parity rotates among the drives.
Advantages
1. Data can be reconstructed using parity bits.
2. It makes the performance better.
Disadvantages
1. Its technology is complex and extra space is required.
2. If both discs get damaged, data will be lost forever.
3. SCAN algorithm
a. The disk arm starts at one end of the disk, and moves toward the other end, servicing
requests until it gets to the other end of the disk, where the head movement is reversed,
and servicing continues.
b. It has two control variables- up and down. Sometimes called the elevator algorithm.
c. If direction is UP, the arm moves in up direction upto the maximum cylinder value
(Higher End of disk). While going up, it will serve all the requests in ascending order.
d. When the bit is set to DOWN, the arm moves in down direction upto the minimum
cylinder value (mostly 0-lower disk end). While going down, it will serve all the
requests in descending order.
e. If no request is pending, it just stops and waits.
f. Disadvantage- Goes all the way to the end of the disk even though request is not there
5. CSCAN Algorithm
a. The head moves from one end of the disk to the other servicing requests as it goes.
b. When it reaches the other end, however, it immediately returns to the beginning of
the disk, without servicing any requests on the return trip.
c. The C-SCAN (circular SCAN) policy restricts scanning to one direction only. This reduces
the maximum delay experienced by new requests.
Any file system provides not only a means to store data organized as files, but a collection of
functions that can be performed on files. Typical operations include the following:
• Create: A new file is defined and positioned within the structure of files. Delete: A file is
removed from the file structure and destroyed.
• Open: An existing file is declared to be “opened” by a process, allowing the process to
perform functions on the file.
• Close: The file is closed with respect to a process, so that the process no longer may
perform functions on the file, until the process opens the file again.
• Read: A process reads all or a portion of the data in a file.
• Write: A process updates a file, either by adding new data that expands the size of the file
or by changing the values of existing data items in the file
• Record
A record is a collection of related fields that can be treated as a unit by some application
program.
• File
A file is a collection of similar records. The file is treated as a single entity by users and
applications and may be referenced by name. Files have file names and may be created and
deleted. Access control restrictions usually apply at the file level. A database is a collection
of related data.
• Database
Database is designed for use by a number of different applications. A database may contain
all of the information related to an organization or project, such as a business or a scientific
study. The database itself consists of one or more types of files. Usually, there is a separate
database management system that is independent of the operating system.
Q. What is File Management Systems? What are Objectives for a File Management
System?
A file management system is that set of system software that provides services to users and
applications in the use of files. Following are the objectives for a file management system.
• To meet the data management needs and requirements of the user which include storage of
data and the ability to perform the aforementioned operations.
• To guarantee, to the extent possible, that the data in the file are valid.
• To optimize performance, both from the system point of view in terms of overall
throughput.
• To provide I/O support for a variety of storage device types.
• To minimize or eliminate the potential for lost or destroyed data.
• To provide a standardized set of I/O interface routines to use processes.
• To provide I/O support for multiple users, in the case of multiple-user systems.
Q. What are Requirements for a general-purpose system?
• Each user should be able to create, delete, read, write and modify
files Each user may have controlled access to other users’ files
• Each user may control what type of accesses are allowed to the users’ files
• Each user should be able to restructure the user’s files in a form appropriate to the
problem Each user should be able to move data between files
• Each user should be able to back up and recover the user’s files in case of
damage Each user should be able to access the user’s files by using
symbolic names
Files exist to store information and allow it to be retrieved later. Different systems provide different
operations to allow storage and retrieval.
The most common system calls relating to files.
1. Create. The file is created with no data. The purpose of the call is to announce that the file is
coming and to set some of the attributes.
2. Delete. When the file is no longer needed, it has to be deleted to free up disk space. There is always
a system call for this purpose.
3. Open. Before using a file, a process must open it. The purpose of the open call is to allow the
system to fetch the attributes and list of disk addresses into main memory for rapid access on later
calls.
4. Close. When all the accesses are finished, the attributes and disk addresses are no longer needed, so
the file should be closed to free up internal table space.
5. Read. Data are read from file. Usually, the bytes come from the current position. The caller must
specify how many data are needed and must also provide a buffer to put them in.
6. Write. Data are written to the file again, usually at the current position. If the current position is the
end of the file, the file’s size increases. If the current position is in the middle of the file, existing data
are overwritten and lost forever.
7. Append. This call is a restricted form of write. It can add data only to the end of the file. Systems
that provide a minimal set of system calls rarely have append, but many systems provide multiple
ways of doing the same thing, and these systems sometimes have append.
8. Seek. For random-access files, a method is needed to specify from where to take the data. One
common approach is a system call, seek, that repositions the file pointer to a specific place in the file.
After this call has completed, data can be read from, or written to, that position.
File Organization is the logical structuring of the records as determined by the way in which
they are accessed. The physical organization of the file on secondary storage depends on the
blocking strategy and the file allocation strategy, issues dealt with later in this chapter.
In choosing a file organization, several criteria are important:
1. Short access time
2. Ease of update
3. Economy of storage
4. Simple maintenance
5. Reliability
The Following are the File Organization
A. The pile
• Least complicated form of file organization
• Data are collected in the order they arrive
• Each record consists of one burst of data
• Purpose is simply to accumulate the mass of data and save it
• Record access is by exhaustive search
o None - The user would not be allowed to read the user directory that includes
the file
o Knowledge - The user can determine that the file exists and who its owner is
and can then petition the owner for additional access rights
o Execution - The user can load and execute a program but cannot copy it
o Reading - The user can read the file for any purpose, including copying and
execution
o Appending - The user can add data to the file but cannot modify or delete any
of the file’s contents
o Updating - The user can modify, delete, and add to the file’s data
o Changing protection - The user can change the access rights granted to other
users
o Deletion - The user can delete the file from the file system
A system called an intrusion detection system (IDS) observes network traffic for malicious
transactions and sends immediate alerts when it is observed. It is software that checks a
network or system for malicious activities or policy violations. IDS monitors a network or
system for malicious activity and protects a computer network from unauthorized access
from users, including perhaps insiders.
• Host-based
– Monitors a single host
• Network-based
– Centrally monitors networks traffic, devices
• Sensors
– Collect data and forward to the analyzer.
• Analyzers
– Determines if an intrusion has occurred
• User interface
Benefits of IDS
• Detects malicious activity: IDS can detect any suspicious activities and alert the system
administrator before any significant damage is done.
• Improves network performance: IDS can identify any performance issues on the
network, which can be addressed to improve network performance.
• Compliance requirements: IDS can help in meeting compliance requirements by
monitoring network activity and generating reports.
• Provides insights: IDS generates valuable insights into network traffic, which can be
used to identify any weaknesses and improve network security.
Q. What Is a Firewall?
A firewall is a network security device that monitors incoming and outgoing network traffic
and decides whether to allow or block specific traffic based on a defined set of security rules.
They establish a barrier between secured and controlled internal networks that can be trusted
and untrusted outside networks, such as the Internet. A firewall can be hardware, software,
software-as-a service (SaaS), public cloud, or private cloud (virtual).
Types of Firewalls
Packet filtering
A small amount of data is analyzed and distributed according to the filter’s standards.
Proxy service
Network security system that protects while filtering messages at the application layer.
Stateful inspection
Dynamic packet filtering that monitors active connections to determine which network
packets to allow through the Firewall.
Graded Questions
1) A disk has 200 cylinders numbered 0 to 199. The disk arm starts at cylinder 53 and the
direction of movement is toward the outer tracks. If the sequence of disk requests is as
follows: 98, 183, 37, 122, 14, 124, 65, 67, Evaluate the total seek time using the FCFS disk
scheduling algorithm.
2) Explain intruders and malicious software in detail.
3) Mention and explain the different file operations performed on the files.
4) Explain the concept of RAID 3 with the help of diagram.
5) Discuss the concept of Contiguous File Allocation method in file management.
6) List and explain the access rights that can be assigned to a particular user for a particular
file.
7) A disk has 200 cylinders numbered 0 to 199. The disk arm starts at cylinder 53 and the
direction of movement is toward the outer tracks. If the sequence of disk requests is as
follows: 98, 183, 37, 122, 14, 124, 65, 67, Evaluate the total seek time using the SSTF disk scheduling
algorithm.
8) What are IDSs and mention the three logical components of IDS?
9) Define File and mention the desirable properties of files.
10) Explain I/O buffering? List and explain its types.
11) Explain the concept of RAID 0 with the help of diagram.
12) What is Indexed Allocation method in file management?
13) A disk has 200 cylinders numbered 0 to 199. The disk arm starts at cylinder 53 and the
direction of movement is toward the outer tracks. If the sequence of disk requests is as
follows: 98, 183, 37, 122, 14, 124, 65, 67, Solve and calculate the total seek time using the
SCAN disk scheduling algorithm.
14) Explain Firewall in detail and list the design goals for firewall.
15) Explain the following terms related to file: Field Record File Database
16) Explain the concept of RAID 1 with the help of diagram.
17) Elaborate Chained Allocation method in file management?
18) List and explain the Access Rights for files that can be assigned to a particular user for a
particular file?
2) RAID level ...... refers to disk arrays with striping at the level of blocks, but without any
redundancy.
a) A 0
b) B 1
c) C 2
d) D 3
3) RAID level 0+1 is used because, RAID level 0 provides whereas RAID level 1
provides
a. performance, redundancy
b. performance, reliability
c. redundancy, performance
d. none of the mentioned
4) A large number of disks in a system improves the rate at which data can be read or written:
a. if the disks are operated on sequentially
b. if the disks are operated on selectively
c. if the disks are operated in parallel
d. all of the mentioned
7) refers to identifying each user of the system and associating the executing
programs with those users.
A. One Time passwords
B. Authentication
C. Program Threats
D. Security
12) Many systems recognize three classifications of users in connection with each file (to
condense the access control list) :
a) ) Universe
b) Group
c) owner
d) All of the mentioned