Os Graded Assignment 2
Os Graded Assignment 2
Os Graded Assignment 2
Graded Assignment# : 02
Subject : Operating system
Submitted to : Madam Munazza mah jabeen
Submitted by : Zulfiqar Ahmed
Reg No : 1441-320006
Q1. Briefly Define the Following:
In this method, the information in the file is processed in order, one record after another. For
example, compiler and various editors access files in this manner.
The read-next – reads the next portion of a file and updates the file pointer which tracks the I/O
location. Similarly, the write-next will write at the end of a file and advances the pointer to the
new end of the file.
You can read block 34, then read 45, and write in block 78, there is no restriction on the order
of access to the file.
The direct access method is used in database management. A query is satisfied immediately by
accessing large
amount of information stored in database files directly.
The database maintains an index of blocks which contains the block number. This block can be accessed
directly and
information is retrieves
There are several logical structures of a directory, these are given below.
Single-level directory –
Single level directory is simplest directory structure. In it all files are contained in same
directory which make it easy to support and understand.
A single level directory has a significant limitation, however, when the number of files increases
or when the system has more than one user. Since all the files are in the same directory, they
must have the unique name . if two users call their dataset test, then the unique name rule
violated.
Two-level directory –
As we have seen, a single level directory often leads to confusion of files names among
different users. the solution to this problem is to create a separate directory for each user.
In the two-level directory structure, each user has there own user files directory (UFD). The UFDs
has similar structures, but each lists only the files of a single user. system’s master file directory
(MFD) is searches whenever a new user id=s logged in. The MFD is indexed by username or
account number, and each entry points to the UFD for that user.
Tree-structured directory –
Once we have seen a two-level directory as a tree of height 2, the natural generalization is to
extend the directory structure to a tree of arbitrary height.
This generalization allows the user to create there own subdirectories and to organize on their
files accordingly.
A tree structure is the most common directory structure. The tree has a root directory, and every
file in the system have a unique path.
Disk Quotas
Quota is the amount of space you have to store files, whether you create or access them from
Linux or Windows. The amount of storage space for files is based on the available disk space on
the ECS file servers and on the type of computer account you hold.
Each computer account has both a hard and a soft quota. The soft quota is the point at which
you are warned that you are approaching your hard quota. The hard quota is the absolute
maximum amount of disk space the system grants your account. Do not exceed your hard
quota; bad things happen if you do: the system will not let you do anything in your account that
requires using additional disk space; you cannot create new files; and any files that you try to
edit may become corrupted. The hard quota takes effect as soon as you exceed it; there is no
grace period.
Example?
SCAN:
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
208 cylinders.
C-SCAN:
It provides a more uniform wait time than SCAN. The head moves from one end of the
disk to the other. Servicing requests as it goes. When it reaches the other end, however,
it immediately returns to the beginning of the disk, without servicing any requests on
the return trip. It treats the cylinders as a circular list that wraps around from the last
cylinder to the first one.
C-LOOK:
It is the Version of C-SCAN. The arm only goes as far as the last request in each direction,
then reverses direction immediately, without first going all the way to the end of the
disk.
Selecting a Disk-Scheduling Algorithm:
SSTF is common and has a natural appeal
SCAN and C-SCAN perform better for systems that place a heavy load on the
disk.
Performance depends on the number and types of requests.
Requests for disk service can be influenced by the file-allocation method.
The disk-scheduling algorithm should be written as a separate module of the
operating system, allowing it to be replaced with a different algorithm if
necessary.
Either SSTF or LOOK is a reasonable choice for the default algorithm
Device Driver
Device driver operates a specific device that is attached to a computer. It provides a software
interface for the device controller to access the hardware devices. Therefore, the operating
system or some other computer programs can access that hardware without knowing much
details about that hardware component. The device driver allows to send data and receive data
from the connected hardware device.
Figure 1: Device Driver
When the operating system or a program needs to communicate with a hardware device, it
invokes a routine in the driver. Then the driver issues commands to that device. When the
device sends data back to the driver, the driver invokes routines in the original calling program.
Device Controller
A device controller is a system that handles the incoming and outgoing signals of the CPU. A
device is connected to the computer via a plug and socket, and the socket is connected to a
device controller. Device controllers use binary and digital codes. An IO device contains
mechanical and electrical parts. A device controller is the electrical part of the IO device.
Figure 2: Device Controller
The device controller receives data from a connected device. It stores that data temporarily in a
special purpose register called a local buffer inside the controller. Each device controller has a
corresponding device driver. The memory is connected to the memory controller. The monitor
is connected to the video controller while the keyboard is connected to the keyboard
controller. Disk drive is connected to the disk controller, and the USB drive is connected to the
USB controller. These controllers are connected to the CPU via the common bus.
Multiprocessors Systems.
Most computer systems are single processor systems i.e they only have one processor.
However, multiprocessor or parallel systems are increasing in importance nowadays. These
systems have multiple processors working in parallel that share the computer clock, memory,
bus, peripheral devices etc. An image demonstrating the multiprocessor architecture is
−
Types of Multiprocessors
There are mainly two types of multiprocessors i.e. symmetric and asymmetric multiprocessors.
Details about them are as follows −
Symmetric Multiprocessors
In these types of systems, each processor contains a similar copy of the operating system and
they all communicate with each other. All the processors are in a peer to peer relationship i.e.
no master - slave relationship exists between them.
An example of the symmetric multiprocessing system is the Encore version of Unix for the
Multimax Computer.
Asymmetric Multiprocessors
In asymmetric systems, each processor is given a predefined task. There is a master processor
that gives instruction to all the other processors. Asymmetric multiprocessor system contains a
master slave relationship.
Asymmetric multiprocessor was the only type of multiprocessor available before symmetric
multiprocessors were created. Now also, this is the cheaper option
Distributed System
A distributed system in its most simplest definition is a group of computers working together
as to appear as a single computer to the end-user.
These machines have a shared state, operate concurrently and can fail independently without
affecting the whole system’s uptime.
I propose we incrementally work through an example of distributing a system so that you can
get a better sense of it all:
A traditional stack
Let’s go with a database! Traditional databases are stored on the filesystem of one single
machine, whenever you want to fetch/insert information in it — you talk to that machine
directly.
For us to distribute this database system, we’d need to have this database run on multiple
machines at the same time. The user must be able to talk to whichever machine he chooses
and should not be able to tell that he is not talking to a single machine — if he inserts a
record into node#1, node #3 must be able to return that record.
The end