0% found this document useful (0 votes)
17 views57 pages

diskschedulingalgorithmspart1

The document discusses disk scheduling and device management in operating systems, detailing how I/O devices are categorized and managed. It explains various disk scheduling algorithms, such as FCFS, SSTF, SCAN, and C-SCAN, along with their advantages and disadvantages. Additionally, it covers the concepts of direct and serial access devices, channels, and control units, emphasizing the importance of efficient resource allocation and performance optimization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views57 pages

diskschedulingalgorithmspart1

The document discusses disk scheduling and device management in operating systems, detailing how I/O devices are categorized and managed. It explains various disk scheduling algorithms, such as FCFS, SSTF, SCAN, and C-SCAN, along with their advantages and disadvantages. Additionally, it covers the concepts of direct and serial access devices, channels, and control units, emphasizing the importance of efficient resource allocation and performance optimization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

Disk Scheduling

Device Management
• Device management in an operating system means controlling the
Input/Output devices like disk, microphone, keyboard, printer,
magnetic tape, USB ports, camcorder, scanner, other accessories, and
supporting units like supporting units control channels. A process
may require various resources, including main memory, file access,
and access to disk drives, and others. If resources are available, they
could be allocated, and control returned to the CPU. Otherwise, the
procedure would have to be postponed until adequate resources
become available. The system has multiple devices, and in order to
handle these physical or virtual devices, the operating system
requires a separate program known as an ad device controller. It also
determines whether the requested device is available.
• The fundamentals of I/O devices may be divided into three
categories:
1.Boot Device
2.Character Device
3.Network Device
• Boot Device
• It stores data in fixed-size blocks, each with its unique address. For
example- Disks.
• Character Device
• It transmits or accepts a stream of characters, none of which can be
addressed individually. For instance, keyboards, printers, etc.
• Network Device
• It is used for transmitting the data packets.
Functions of the device management in the operating system

• The operating system (OS) handles communication with the devices via their
drivers. The OS component gives a uniform interface for accessing devices with
various physical features. There are various functions of device management in the
operating system. Some of them are as follows:
1. It
keeps track of data, status, location, uses, etc. The file system is a term used to
define a group of facilities.
2. It
enforces the pre-determined policies and decides which process receives the
device when and for how long.
3. It improves the performance of specific devices.
4. It
monitors the status of every device, including printers, storage drivers, and other
devices.
5. It
allocates and effectively deallocates the device. De-allocating differentiates the
devices at two levels: first, when an I/O command is issued and temporarily freed.
Second, when the job is completed, and the device is permanently release
Types of devices
• Thereare three types of Operating system peripheral
devices:
• Dedicated
• shared

Virtual
Dedicated device
• Indevice management, some devices are allocated or assigned to
only one task at a time until that job releases them. Devices such as
plotters, printers, tape drivers, and other similar devices necessitate
such an allocation mechanism because it will be inconvenient if
multiple people share them simultaneously. The disadvantage of
such devices is the inefficiency caused by allocating the device to a
single user for the whole duration of task execution, even if the
device is not used 100% of the time.
Shared Devices
• These devices could be assigned to a variety of processes. By
interleaving their requests, disk-DASD( direct-access
storage device) could be shared by multiple processes
simultaneously. The Device Manager carefully controls the
interleaving
Virtual devices
• Virtual devices are a hybrid of the two devices, and they are
dedicated devices that have been transformed into shared devices.
For example, a printer can be transformed into a shareable device by
using a spooling program that redirects all print requests to a disk. A
print job is not sent directly to the printer; however, it is routed to the
disk until it is fully prepared with all of the required sequences and
formatting, at which point it is transmitted to the printers. The
approach can transform a single printer into numerous virtual
printers, improving performance and ease of use.
Serial access devices
• Sequentialaccess means the system must search the storage device
from the beginning of the memory address until it finds the required
piece of data. Memory device which supports such access is called a
Sequential Access Memory or Serial Access Memory. Magnetic tape
is an example of serial access memory.
Direct access devices
• Direct access memory or Random Access Memory, refers to
conditions in which a system can go directly to the information that
the user wants. Memory device which supports such access is called
a Direct Access Memory. Magnetic disks, optical disks are examples
of direct access memory.
Direct access storage device (DASD)
• A direct access storage device is a type of secondary storage device
that supports direct access to stored data, as opposed to sequential
access, which is slower and less efficient. In this case, secondary
storage refers to nonvolatile media, including hard disk drives (
HDDs) and solid-state drives (SSDs.
• Is the concept of direct access, which refers to how data is accessed
on a storage device. With direct access, data can be written to or read
from the storage media by going directly to a specific physical
location on the device. A direct access storage device includes the
mechanisms that enable read and write operations at any
addressable location on the device.
DASD
• Directaccess means not having to search sequentially through the
data. With sequential access, data is accessed by starting at one
location and then going through successive locations until the data is
found. A tape storage system, such as the type used for
archiving data, is an example of a sequential access storage device,
which is inherently slower than DASD.
Channels
• A channel is an independent hardware component that co-ordinate
all I/O to a set of controllers. Computer systems that use I/O channel
have special hardware components that handle all I/O operations.
• Channels use separate, independent and low cost processors for its
functioning which are called Channel Processors.
• Channel processors are simple, but contains sufficient memory to
handle all I/O tasks. When I/O transfer is complete or an error is
detected, the channel controller communicates with the CPU using
an interrupt, and informs CPU about the error or the task
completion.
• Each channel supports one or more controllers or devices. Channel
programs contain list of commands to the channel itself and for
various connected controllers or devices. Once the operating system
has prepared a list of I/O commands, it executes a single I/O
machine instruction to initiate the channel program, the channel then
assumes control of the I/O operations until they are completed.
• Multiplexer
The Multiplexer channel can be connected to a number of slow and
medium speed devices. It is capable of operating number of I/O devices
simultaneously
• Selector
This channel can handle only one I/O operation at a time and is used to
control one high speed device at a time.
• Block-Multiplexer
It combines the features of both multiplexer and selector
channels.
The CPU directly can communicate with the channels
through control lines. Following diagram shows the word
format of channel operation.
control units
• The control unit is a part of the Central Processing Unit (CPU). The CPU is
divided into the arithmetic logic unit and the control unit. The control unit
generates the appropriate timing and control signals to all the operations
involved with a computer. The flow of data between the processor, memory, and
other peripherals is controlled using the timing signals of the control unit.
• The main function of a control unit is to fetch the data from the main memory,
determine the devices and the operations involved with it, and produce control
signals to execute the operations.
• The functions of the control unit are as follows −
• It helps the computer system in the process of carrying out the stored program
instructions.
• It interacts with both the main memory and arithmetic logic unit.
• It performs arithmetic or logical operations.
• It coordinates with all the activities related to the other units and the peripherals.
Disk Scheduling algorithm basics
• A process needs two type of time, CPU time and IO time. For I/O, it
requests the Operating system to access the disk.
• However, the operating system must be fare enough to satisfy each
request and at the same time, operating system must maintain the
efficiency and speed of process execution.
• The technique that operating system uses to determine the request
which is to be satisfied next is called disk scheduling.
Disk Scheduling algorithm basics
• Seek Time
• Seek time is the time taken in locating the disk arm to a specified track where the
read/write request will be satisfied.
• Rotational Latency
• It is the time taken by the desired sector to rotate itself to the position from where
it can access the R/W heads.
• Transfer Time
• It is the time taken to transfer the data.
• Disk Access Time
• Disk access time is given as,
• Disk Access Time = Rotational Latency + Seek Time + Transfer Time
• Disk Response Time
• It is the average of time spent by each request waiting for the IO operation.
Purpose of Disk Scheduling
• The main purpose of disk scheduling algorithm is to select a disk
request from the queue of IO requests and decide the schedule when
this request will be processed.
• Goal of Disk Scheduling Algorithm
The main purposes of scheduling algorithms are to minimize
resource starvation
Disk Scheduling Algorithms
• FCFS scheduling algorithm
• SSTF (shortest seek time first) algorithm
• SCAN scheduling
• C-SCAN scheduling
• LOOK Scheduling
• C-LOOK scheduling
FCFS

• FCFS serves the requests in the order they arrive


• There is no starvation
• It does not provide the fast service
• Simplest of all scheduling algorithms
• Advantages
• Every request gets a fair chance
• No indefinite Postponement
• Disadvantages
• Does not try to optimize seek time
• May not provide the best possible service
Disk Scheduling (Cont.)
 Several algorithms exist to schedule the
servicing of disk I/O requests.
 We illustrate them with a request queue (0-
199).

98, 183, 37, 122, 14, 124, 65, 67

Head pointer 53

24
FCFS

Illustration shows total head movement of 640 cylinders.


25
Total Head Movements

1. 98-53=45
2. 183-98=85
3. 183-37=146
4. 122-37=85
5. 124-65=59
6. 122-14=108
7. 124-14=110
8. 124-65=59
9. 67-65=2
• Now add all we get 640 head movements
SS T F

Selects the request with the minimum seek time


from the current head position.
 SSTF scheduling is a form of SJF
scheduling; may cause starvation of some
requests
 Illustration shows total head movement of
236 cylinders.

27
Advantages and Disadvantage

• Advantage
• Average response time decreases
• Throughput increases
• Disadvantage
• Overhead to calculate seek time in advance
• Can
cause starvation for a request if it has higher seek time as
compared to incoming requests
• Highvariance of response time as SSTF favours only some
request
SSTF (Cont.)

236ead movements

29
Total Head Movements

1 . 65-53=12
2. 67-65=2
3. 67-37=30
4. 37-14=23
5. 98-14=84
6. 122-98=24
7. 124-122=2
8. 183-124=59
Total Head Movements = 236
SC A N
 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.
 Sometimes called the elevator algorithm.
 Illustration shows total head movement of
236 cylinders.
31
SCAN
(Elevator)

32
Total Head Movement

1 53-37=16
2.37-14=23
314-0=14
4.65-0=65
5.67-65=2
6.98-67=31
7.122-98=24
8.124-122=2
9.183-124=59
Total =236
Advantages and Disadvantages

Advantages
High throughput
Low Variance of response time
Average response time
Disadvantages
Long Waiting time for requests for locations just visited by disk
arm
C-SCAN
•Circular-SCAN Algorithm is an improved version of the SCAN Algorithm.
•Head starts from one end of the disk and move towards the other end servicing all
the requests in between.
•After reaching the other end, head reverses its direction.
•It then returns to the starting end without servicing any request in between.
•The same process repeats.
Advantages-

•The waiting time for the cylinders just visited by the head is reduced as
compared to the SCAN Algorithm.
•It provides uniform waiting time.
•It provides better response time.

Disadvantages-

•It causes more seek movements as compared to SCAN Algorithm.


•It causes the head to move till the end of the disk even if there are no requests to
be serviced.
Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14,
124, 65, 67. The C-SCAN scheduling algorithm is used. The head is initially at cylinder
number 53 moving towards larger cylinder numbers on its servicing pass. The cylinders
are numbered from 0 to 199. The total head movement (in number of cylinders) incurred
while servicing these requests is _______.
C-SCAN

Total head movements incurred while servicing these requests


= (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 –
124) + (199 – 183) + (199 – 0) + (14 – 0) + (41 – 14)
= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 199 + 14 + 27
= 386

Alternatively,
Total head movements incurred while servicing these requests
= (199 – 53) + (199 – 0) + (41 – 0)
= 146 + 199 + 41
Look
•LOOK Algorithm is an improved version of the SCAN Algorithm.
•Head starts from the first request at one end of the disk and moves towards the
last request at the other end servicing all the requests in between.
•After reaching the last request at the other end, head reverses its direction.
•It then returns to the first request at the starting end servicing all the requests in
between.
•The same process repeats.
The main difference between SCAN Algorithm and LOOK Algorithm is-
•SCAN Algorithm scans all the cylinders of the disk starting from one end to the
other end even if there are no requests at the ends.
•LOOK Algorithm scans all the cylinders of the disk starting from the first request at
one end to the last request at the other end.

Advantages-

•It does not causes the head to move till the ends of the disk when there are no
requests to be serviced.
•It provides better performance as compared to SCAN Algorithm.
•It does not lead to starvation.
•It provides low variance in response time and waiting time.

Disadvantages-

•There is an overhead of finding the end requests.


•It causes long waiting time for the cylinders just visited by the head.
Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 124, 65, 67.
The LOOK scheduling algorithm is used. The head is initially at cylinder number 53 moving
towards larger cylinder numbers on its servicing pass. The cylinders are numbered from 0 to 199.
The total head movement (in number of cylinders) incurred while servicing these requests is
_______.
= 12 + 2 + 31 + 24 + 2 + 59 + 142 + 27
= 299

Alternatively,
Total head movements incurred while servicing these requests
= (183 – 53) + (183 – 14)
= 130 + 16
C-Look
•Circular-LOOK Algorithm is an improved version of the
LOOK Algorithm.
•Head starts from the first request at one end of the disk and moves towards
the last request at the other end servicing all the requests in between.
•After reaching the last request at the other end, head reverses its direction.
•It then returns to the first request at the starting end without servicing any
request in between.
•The same process repeats.
Advantages-
•It does not causes the head to move till the ends of the disk when there are no
requests to be serviced.
•It reduces the waiting time for the cylinders just visited by the head.
•It provides better performance as compared to LOOK Algorithm.
•It does not lead to starvation.
•It provides low variance in response time and waiting time
Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 124, 65, 67.
The C-LOOK scheduling algorithm is used. The head is initially at cylinder number 53 moving
towards larger cylinder numbers on its servicing pass. The cylinders are numbered from 0 to 199.
The total head movement (in number of cylinders) incurred while servicing these requests is
_______.
= 12 + 2 + 31 + 24 + 2 + 59 + 169 + 27
= 326

Alternatively,
Total head movements incurred while servicing these requests
= (183 – 53) + (183 – 14) + (41 – 14)
= 130 + 169 + 27
= 326
OS Security
The process of ensuring OS availability, confidentiality, integrity is known as
operating system security. OS security refers to the processes or measures taken to
protect the operating system from dangers, including viruses, worms, malware,
and remote hacker intrusions. Operating system security comprises all preventive-
control procedures that protect any system assets that could be stolen, modified, or
deleted if OS security is breached.
Security refers to providing safety for computer system resources like software,
CPU, memory, disks, etc. It can protect against all threats, including viruses and
unauthorized access. It can be enforced by assuring the operating
system's integrity, confidentiality, and availability.
Availability
Availability is one of the three basic functions of security management that
are present in all systems. Availability is the assertion that a computer
system is available or accessible by an authorized user whenever it is
needed. Systems have high order of availability to ensures that the system
operates as expected when needed.

There are mainly two threats to availability of the system which are
as follows:
1. Denial of Service 2. Loss of Data Processing Capabilities
DOS
Denial of Service specifies to actions that lock up computing services in a way
that the authorized users is unable to use the system whenever needed.
Availability is also blocked in case, if a security office unintentionally locks up
an access control of database during the routine maintenance of the system
thus for a period of time authorized users are block to access. In the computer
systems, internet worm overloaded about 10% of the system on the network,
causing them to be non responsive to the need of users is an example of denial
of service.
1. Threat
A program that has the potential to harm the system seriously.
2. Attack
A breach of security that allows unauthorized access to a resource.
There are two types of security breaches that can harm the system: malicious and
accidental. Malicious threats are a type of destructive computer code or web
script that is designed to cause system vulnerabilities that lead to back doors and
security breaches. On the other hand, Accidental Threats are comparatively
easier to protect against.
Some of the breaches are as follow

Breach of integrity
This violation has unauthorized data modification
2. Theft of service
It involves the unauthorized use of resources.
3. Breach of confidentiality
It involves the unauthorized reading of data.

4. Breach of availability
It involves the unauthorized destruction of data.
5. Denial of service
It includes preventing legitimate use of the system.
Some attacks may be accidental.
The goal of Security System
There are several goals of system security. Some of them are as follows:
1. Integrity
Unauthorized users must not be allowed to access the system's objects, and users with
insufficient rights should not modify the system's critical files and resources.
2. Secrecy
The system's objects must only be available to a small number of authorized users.
The system files should not be accessible to everyone.
3. Availability
All system resources must be accessible to all authorized users, i.e., no single
user/process should be able to consume all system resources. If such a situation arises,
service denial may occur. In this case, malware may restrict system resources and
preventing legitimate processes from accessing them.
Types of Threats
Program threats
The operating system's processes and kernel carry out the specified task as directed.
Program Threats occur when a user program causes these processes to do malicious
operations. The common example of a program threat is that when a program is installed
on a computer, it could store and transfer user credentials to a hacker. There are various
program threats. Some of them are as follows:
1.Virus
A virus may replicate itself on the system. Viruses are extremely dangerous and can
modify/delete user files as well as crash computers. A virus is a little piece of code that is
implemented on the system program. As the user interacts with the program, the virus
becomes embedded in other files and programs, potentially rendering the system
inoperable.
2. Trojan Horse
This type of application captures user login credentials. It stores them to transfer them to a
malicious user who can then log in to the computer and access system resources.
3. Logic Bomb
A logic bomb is a situation in which software only misbehaves when particular
criteria are met; otherwise, it functions normally.

4. Trap Door
A trap door is when a program that is supposed to work as
expected has a security weakness in its code that allows it to do
illegal actions without the user's knowledge.

You might also like