File Management
File Management
File Management
A file management system is a type of software that manages data files in a computer
files, such as special office documents and records. It may display report details,
like owner, creation date, state of completion and similar features useful in an office
Terms
File manager
In general, file manager refers to a software program that is often a portion of the
operating system that helps a user manage all the files on their computer. For
example, all file managers allow the user to view, edit, copy, and delete the files on
their computer. File Manager is a program included with Windows that enabled
users to manage their files on the computer. A file manager or file browser is a
computer program that provides a user interface to manage files and folders. The
deleting and searching for files, as well as modifying file attributes, properties and
file permissions. Folders and files may be displayed in a hierarchical tree based on
their directory structure. Some file managers contain features inspired by web
browsers, including forward and back navigational buttons. Some file managers
provide network connectivity via protocols, such as FTP, NFS, SMB or WebDAV. This
is achieved by allowing the user to browse for a file server (connecting and
accessing the server's file system like a local file system) or by providing its own full
• Use a directory to describe the location of all files plus their attributes
Optimize performance
File systems
A file system is the methods and data structures that an operating system uses to
keep track of files on a disk or partition; that is, the way the files are organized on the
disk. The word is also used to refer to a partition or disk that is used to store the files
Naming
FAT
Part of a hard disk where the size and location (and other items of information) of
every file on that disk is recorded for fast access by the computer's operating
system.
FAT features
A FAT volume is divided into several regions, which are shown in Figure 12-2. The
file allocation table, which gives the FAT file system format its name, has one entry
for each cluster on a volume. Because the file allocation table is critical to the
successful interpretation of a volume's contents, the FAT format maintains two copies
Chkdsk) can't access one (because of a bad disk sector, for example) it can read
NTFS offers major improvements over FAT in the areas of performance, reliability
The NTFS file system includes security features required for file servers in a
privileges. NTFS files and folders can have permissions assigned whether they are
shared or not. NTFS is the only Microsoft file system that allows permissions to be
The NTFS design is simple but powerful. Everything on an NTS volume is a file and
everything in a file is an attribute, e.g.: data attribute, security attribute, file name
attribute, etc. Every allocated sector on an NTFS volume belongs to some file.
Features of NTFS
NTFS supports multiple data streams, where the stream name identifies a new data
With compression it is possible to store most files in a way that they take up less
All the recourses in a system are treated as objects. Any user who wants access to
these objects should have the right to do so. This feature cannot be overridden in
any way, including attempt to view the volume through another operating system.
One of the security features is encryption. The Encrypting File System provides the
core file encryption technology used to store encrypted files on NTFS volumes and
very much safe password on the system itself, this possibility provides the safety of
files selected by the user. If an intruder tries to access, open, read, copy, move or
rename the encrypted file or folder, he/she receives an access denied message.
A sparse file has an attribute that causes the I/O subsystem to allocate only
meaningful data. Nonzero data is allocated on disk, and non-meaningful data is not.
When a sparse file is read, allocated data is returned, as it was stored; non-allocated
data is returned, by default, as zeros. NTFS deallocates sparse data streams and only
maintains other data as allocated. When a program accesses a sparse file, the file
system yields allocated data as actual data and deallocated data as zeros.
i. NTFS uses Unicode to save filenames. It was impossible to read or access files
ii. NTFS has a built-in security system which controls sharing of files between
users.
iii. NTFS can encrypt and decrypt files and folders while reading or writing them.
iv. It can compress and decompress individual files and folders just as easily.
preventing unfair behavior when a user grabs all available disk space for his
vi. NTFS can successfully deal with very large files and partitions.
Disadvantages
A boot sector or boot block is a region of a hard disk, floppy disk, optical disc, or
other data storage device that contains machine code to be loaded into random-
boot sector is to allow the boot process of a computer to load a program (usually, but
The master file table (MFT) is a database in which information about every file and
directory on an NT File System (NTFS) volume is stored. There is at least one record
System files
Where executable files (in machine language) that are part of the operating system
File area
Directory implementation
precisely that a place for listing and locating files. Internally, directories themselves
cabinet. Files are organized by storing related files in the same directory. In a
subdirectory.
Linear list
Advantages
Simple to program
Disadvantages
Time-consuming to execute
Hash table
Hash tables are unordered structures; you would typically sort them in
Advantages
Fasterfile search
Disadvantages
10
File allocation method refers to how disk blocks are allocated for files:
Contiguous allocation
Contiguous allocation supports sequential and direct access well, but is very prone
to external fragmentation and requires prior file size knowledge. Each file occupies
Advantages
Simple – only starting location (block #) and length (number of blocks) are
required
Random access
Disadvantages
Wasteful of space
11
Linked allocation
Linked allocation treats disk blocks as nodes on a linked list. A file’s directory entry
serves as the list head, and each disk block stores a pointer to the next disk block.
Each file is a linked list of disk blocks: blocks may be scattered anywhere on the
disk.
Advantages
No waste of space
No random access
Disadvantages
High relative fragility of a linked list (i.e., one bad pointer screws everything
up).
Indexed allocation
Indexed allocation uses an index block, which resembles the page tables used for
main memory management. Each file has an index block, and this index block
contains all of the pointers to the file’s data blocks. The file’s directory entry points
to its index block. Like linked allocation, indexed allocation addresses external
fragmentation and file size issues, but may actually have more overhead — the index
block itself particularly for small files (because even a zero length file uses up at
13
Advantages
Disadvantages
Directory Levels
Single-Level Directory
In this type of directory system, there is a root directory which has all files. It has a
simple architecture and there are no sub directories. Advantage of single level
14
directory system is that it is easy to find a file in the directory. This type of directory
directory. At the top of the hierarchy is the root directory and then there are sub
Advantages
Users can be provided access to a sub directory rather than the entire
directory.
15
Tree-structured directory
It is an extension to the two-tiered directory structure, and the one with which we are
all most familiar. Each user / process has the concept of a current directory from
which all files may be accessed using either absolute pathnames or relative
pathnames. Directories are stored the same as any other file in the system, except
there is a bit that identifies them as directories, and they have some special structure
Acyclic-Graph Directories
16
17
File Sharing
with different levels of sharing privileges. Operating systems also provide file-
The file system should provide a flexible tool for allowing extensive file sharing
among users.
Access Rights
These are permissions by users to access files in a system. The file system should
provide a number of options so that the way in which a particular file is accessed can
be controlled. Typically, users or groups of users are granted certain access rights
to a file. A wide range of access rights has been used. The following list is
particular file:
None
The user may not even learn of the existence of the file, much less access it. To
enforce this restriction, the user would not be allowed to read the user directory that
18
Knowledge
The user can determine that the file exists and who its owner is. The user is then able
Execution
The user can load and execute a program but cannot copy it. Proprietary programs
Reading
The user can read the file for any purpose, including copying and execution. Some
systems are able to enforce a distinction between viewing and copying. In the
former case, the contents of the file can be displayed to the user, but the user has no
Appending
The user can add data to the file, often only at the end, but cannot modify or delete
any of the file’s contents. This right is useful in collecting data from a number of
sources.
Updating
The user can modify, delete, and add to the file’s data. This normally includes
writing the file initially, rewriting it completely or in part, and removing all or a
portion of the data. Some systems distinguish among different degrees of updating.
19
Changing protection
The user can change the access rights granted to other users. Typically, this right is
held only by the owner of the file. In some systems, the owner can extend this right
to others. To prevent abuse of this mechanism, the file owner will typically be able to
Deletion
The user can delete the file from the file system. These rights can be considered to
constitute a hierarchy, with each right implying those that precede it. Thus, if a
particular user is granted the updating right for a particular file, then that user is also
Specific User
Owner All
Users Groups
usually the
initial creator of all users who
the file have access to
this system
individual users a set of users
who are who are not
has full rights
designated by individually
user ID defined
these are public
may grant rights files
to others
20
One user is designated as owner of a given file, usually the person who initially
created a file. The owner has all of the access rights listed previously and may grant
Specific user
User groups
A set of users who are not individually defined. The system must have some
All
All users who have access to this system. These are public files.
Mode of access
Read
Write
Execute
File systems allocate space in a granular manner, usually multiple physical units on
the device. The file system is responsible for organizing files and directories, and
keeping track of which areas of the media belong to which file and which are not
being used.
This results in unused space when a file is not an exact multiple of the allocation unit.
The size of the allocation unit is chosen when the file system is created. Choosing the
21
allocation size based on the average size of the files expected to be in the file system
can minimize the amount of unusable space. Frequently the default allocation may
provide reasonable usage. Choosing an allocation size that is too small results in
excessive overhead if the file system will contain mostly very large files.
Continuous
space.
Advantages
22
Non-Continuous
This scheme has replaced the previous ones. The popular non-contiguous
storages because the files do tend either to grow or shrink over time and
users rarely know in advance how large their files will be contiguous.
Linked/Chained Collection
Linked allocation is essentially a disk-based version of the linked list. The disk
pointer to the first and last block of the file. Also each block contains pointers
to the next block, which are not made available to the user. It can be used
effectively for sequential access only but there also it may generate long
seeks between blocks. Another issue is the extra storage space required for
pointers. Yet the reliability problem is also there due to loss/damage of any
pointer.
23
Indexed Allocation
allocation. In this case, the file allocation table contains a separate one-level
index for each file; the index has one entry for each portion allocated to file.
Typically, the file indexes are not physically stored as part of the file
allocation table. Rather, the index for a file is kept in a separate block, and
entry for the file in the allocation table points to that block. The allocation may
24
The system that an operating system or program uses to organize and keep track of
files. It is the subsystem of an operating system that manages the data storage
this sense, it interfaces the application programs with the low-level media-I/O
subsystem, freeing on the application programmers from having to deal with low-
level intricacies and allowing them to implement I/O using convenient data-
organizational abstractions like files and records. On the other end, the FMS services
often is the only way thorough which applications can access the data stored in the
files, thus achieving an encapsulation of the data themselves which can be usefully
25
Data Management
The FMS data abstractions and access methods should remain unchanged
Validity
An FMS should guarantee that at any given moment the stored data reflect the
Protection
26
Concurrency
Performance
User's (or user groups') ownership of files, and access control on the basis of
ownership permissions.
Logical identification and structuring of the data, via file names and
27
Disk access is the bottleneck for the file system performance. Most systems maintain
a separate section of main memory for a disk cache (block cache, or buffer cache),
where blocks are kept under the assumption that they will be re-used in near future.
The logical file system is the level of the file system at which users can request file
operations by system call. This level of the file system provides the kernel with a
consistent view of what might be multiple physical file systems and multiple file
system implementations. As far as the logical file system is concerned, file system
are indistinguishable.
A consistent view of file system implementations is made possible by the virtual file
system abstraction. This abstraction specifies the set of file system operations that an
implementation must include in order to carry out logical file system requests.
Physical file systems can differ in how they implement these predefined operations,
but they must present a uniform interface to the logical file system. Each set of
single physical file system can appear to the logical file system as one or more
Virtual file system operations are available at the logical file system level through
the virtual file system switch. This array contains one entry for each virtual file
28
system, with each entry holding entry point addresses for separate operations. Each
file system type has a set of entries in the virtual file system switch.
The logical file system and the virtual file system switch support other operating
system file-system access semantics. This does not mean that only other operating
system file systems can be supported. It does mean, however, that a file system
implementation must be designed to fit into the logical file system model.
Logical file system can also refer to the tree of known path names in force while the
system is running. A virtual file system that is mounted onto the logical file system
tree itself becomes part of that tree. In fact, a single virtual file system can be
mounted onto the logical file system tree at multiple points, so that nodes in the
virtual subtree have multiple names. Multiple mount points allow maximum
several different types of media, including hard drives, CD-ROM drives, and floppy
drives. Each of these devices has a distinct physical file system associated with it.
29
File allocation
This is the way files size and location in the hard disk are recorded for fast access by
and availability. OS security refers to specified steps or measures used to protect the
File protection
Refers to the prevention of erasing of or writing upon a disk but allows a program to
moving a lever or covering a notch. Writing is prohibited even if the software directs
30
the computer to do so. For example, on the earlier half-inch tape, a plastic ring in the
Logical file protection is provided by the operating system, which can designate
files as read only. This allows both regular (read/write) and read only files to be
stored on the same disk volume. Files can also be designated as hidden files, which
File security
then he/she may cause severe damage to computer or data stored in it. So a
Data confidentiality
Data integrity
31
System availability
Privacy
Malicious intruders
attack and other hacker risks so that the software continues to function correctly
Security vulnerabilities
a system susceptibility or flaw, attacker access to the flaw, and attacker capability to
Application Vulnerability
exploited to compromise the security of the application. Once an attacker has found
32
a flaw, or application vulnerability, and determined how to access it, the attacker has
Buffer Overflows
A buffer overflow occurs when an application attempts to write data past the end of a
buffer. Buffer overflows can cause applications to crash, can compromise data, and
can provide an attack vector for further privilege escalation to compromise the
Invalidated Input
As a general rule, you should check all input received by your program to make
sure that the data is reasonable. Any input received by your program from an
Race Conditions
A race condition exists when changes to the order of two or more events can cause a
change in behavior. If the correct order of execution is required for the proper
functioning of the program, this is a bug. If an attacker can take advantage of the
situation to insert malicious code, change a filename, or otherwise interfere with the
33
Attackers can sometimes take advantage of small time gaps in the processing of
code to interfere with the sequence of operations, which they then exploit.
Interprocess Communication
are often vulnerable to attack; thus, when writing an application, you must always
assume that the process at the other end of your communication channel could be
hostile.
a file that might not be true. For example, you might assume that you can always
write to a file created by your program. However, if an attacker can change the
permissions or flags on that file after you create it, and if you fail to check the result
code after a write operation, you will not detect the fact that the file has been
tampered with.
34
Access control is the process of controlling who is allowed to do what. This ranges
room, for example to specifying who has access to a resource and what they are
allowed to do with that resource. Some access control mechanisms are enforced by
service in use. Many security vulnerabilities are created by the careless or improper
Security attacks
This malicious software includes viruses, spywares, adwares, and Trojan horses.
This software often deletes certain vital files on your computer, making your
computer to function abnormally, spying on your online surfing habits, and cause
Types of attack
Passive Attack
A passive attack monitors unencrypted traffic and looks for clear-text passwords and
sensitive information that can be used in other types of attacks. Passive attacks
35
upcoming actions. Passive attacks result in the disclosure of information or data files
Active Attack
In an active attack, the attacker tries to bypass or break into secured systems. This
can be done through stealth, viruses, worms, or Trojan horses. Active attacks include
and to steal or modify information. These attacks are mounted against a network
data.
Distributed Attack
A distributed attack requires that the adversary introduce code, such as a Trojan
distributed to many other companies and users Distribution attacks focus on the
These attacks introduce malicious code such as a back door to a product to gain
36
Insider Attack
Close-in Attack
components, data, and systems in order to learn more about a network Close-in
attack, the attacker compromises the network or system through social interaction
with a person, through an e-mail message or phone. Various tricks can be used by
information that the victim reveals to the hacker would most likely be used in a
37
Phishing Attack
In phishing attack the hacker creates a fake web site that looks exactly like a popular
site such as PayPal. The phishing part of the attack is that the hacker then sends an e-
mail message trying to trick the user into clicking a link that leads to the fake site.
When the user attempts to log on with their account information, the hacker records
the username and password and then tries that information on the real site.
Hijack attack
Hijack attack In a hijack attack, a hacker takes over a session between you and
another individual and disconnects the other individual from the communication.
You still believe that you are talking to the original party and may send private
Spoof attack
Spoof attack in a spoof attack, the hacker modifies the source address of the packets
he or she is sending so that they appear to be coming from someone else. This may
Buffer overflow
Buffer overflow A buffer overflow attack is when the attacker sends more data to an
application than is expected. A buffer overflow attack usually results in the attacker
38
Exploit attack
Exploit attack In this type of attack, the attacker knows of a security problem within
Password attack
Password attack an attacker tries to crack the passwords stored in a network account
attack uses a word list file, which is a list of potential passwords. A brute-force attack
39
Authentication is the process of verifying who you are. When you log on to a PC with
or what it claims to be. That is, authentication is proving that you are you, or that a
Authorization is the process of verifying that you have access to something. Gaining
can perform a given action. That is, once a user is authenticated as a particular user,
Word or Excel file. Each time the file is run, the virus runs too. It attaches itself to
40
A Worm uses computer networks to replicate itself. It searches for servers with
security holes and copies itself there. It then begins the search and replication
process again.
program. However, when it runs it does something else - like erasing your hard
Audit trail
A record showing who has accessed a computer system and what operations he or
she has performed during a given period of time. Audit trails are useful both for
maintaining security and for recovering lost transactions. Most accounting systems
there are separate audit trail software products that enable network administrators
An audit trail also called audit log is a security-relevant chronological record, set of
evidence of the sequence of activities that have affected at any time a specific
operation, procedure, or event. Audit records typically result from activities such as
41
Accountability
Log data can identify what accounts are associated with certain events. This
information then can be used to highlight where training and/or disciplinary actions
are needed.
Reconstruction
Log data can be reviewed chronologically to determine what was happening both
before and during an event. For this to happen, the accuracy and coordination of
system clocks are critical. To accurately trace activity, clocks need to be regularly
synchronized to a central source to ensure that the date/time stamps are in synch.
Intrusion Detection
Unusual or unauthorized events can be detected through the review of log data,
assuming that the correct data is being logged and reviewed. The definition of what
constitutes unusual activity varies, but can include failed login attempts, login
Problem Detection
In the same way that log data can be used to identify security events, it can be used
42
Access control is the selective restriction of access to a place or other resource. The
resource is called authorization. Each file management system has its own method to
characterize the rights of each subject with respect to every object in the
system
Advantages
i. Easy to implement
ii. Works well for systems with few files & few users
43
An access control list is a table that tells a computer operating system which
access rights each user has to a particular system object, such as a file
directory or individual file. Each object has a security attribute that identifies
its access control list. The list has an entry for each system user with access
privileges. The most common privileges include the ability to read a file, to
Contains the name of only those users who may use file; those denied any
access are grouped under “WORLD”. List is shortened by putting users into
categories:
44
Advantages
ii. Each file is entered in list & contains names of users who are allowed
c) Capability lists
Lists all the access rights or capabilities that a user has. A row of an access
matrix that contains the access rights of a given user to various files and other
Examples
> /usr/ucb/vi(X)
45
When a process tries to gain access to an object, the operating system can
Advantages
i. Lists every user and the files to which each has access
Disadvantages
i. If each capability list has an entry for all objects, many entries will indicate
ii. It can be expensive to search capability lists for such users, unless we use
in more detail.
iii. An initial capability list must be generated for a new user. It is not clear
46
d) Lockword control
Advantages
Disadvantages
iv. Anyone who knows lockword can read, write, execute, or delete file
Data Compression
47
Examples
Repeated terms
Examples
In a university’s student database common words like student, course, grade, &
48
I/O devices are typically quite complex mechanically and electronically. Much of
user or the programmer. The average user is not aware of the complexities of
positioning the heads on a disk drive, reading the signal from the disk surface,
49
Users and programmers may be unaware of this complexity. The I/O management
module must try to treat all external devices uniformly. This is achieved by virtual
device. A virtual device is a special kind of file that is associated with a particular
external device. Users create a virtual device of a given type, and operating system
associates a physical device with it when the device is required for the first time. All
Efficiency
Perhaps the most significant characteristic of the I/O system is. the speed disparity
between it and the processor. I/O devices involve mechanical operations. They
cannot compete with the microsecond or nanosecond speed of the processor and
memory. The I/O management module must try to minimize the disparity by the use
Uniform naming
Error handling
50
Buffering
Device independence
function on a wide variety of devices regardless of the local hardware on which the
software is used. The process should not depend on one particular device.
The principle of device independence works very well with respect to random
upward cares what kind of storage device it's reading from/ writing to.
51
Efficiency
The speed disparity between it and the processor. I/O devices involve mechanical
operations. They cannot compete with the microsecond or nanosecond speed of the
processor and memory. The I/O management module must try to minimize the
devices.
This is achieved by the Virtual Device. Users interact with Virtual Devices
52
Advantages
User does not need to know which specific Phy. Device will be used by a
process
Easy to change device from, say, Tape to Disk, without having to rewrite large
chunks of code.
I/O Devices
An input/output (I/O) device is a hardware device that has the ability to accept
inputted, outputted or other processed data. It also can acquire respective media
data as input sent to a computer or send computer data to storage media as storage
53
output. Input devices provide input to a computer, while output devices provide a
way for a computer to output data for communication with users or other computers.
Input Devices
Graphics Tablets
Cameras
Trackballs
Barcode reader
Digital camera
Gamepad
Joystick
Keyboard
Microphone
MIDI keyboard
Scanner
Webcam
Touchpads
Pen Input
Microphone
Electronic Whiteboard
54
Output devices
Monitor
Plotters
Projector
Speaker(s)
Modems
Network cards
Touch Screen
Headsets
Facsimile (FAX)
Block Devices
Block devices usually behave a lot like ordinary files: they are an array of bytes, and
the value that is read at a given location is the value that was last written there. Data
from block device can be cached in memory and read back from cache; writes can
be buffered. Block devices are normally searchable. The name block device comes
55
from the fact that the corresponding hardware typically reads and writes a whole
block at a time.
Usually accessed via a file system interface raw I/O: OS, DBMS may directly access
Character devices
Character devices behave like pipes, serial ports, etc. Writing or reading to them is
an immediate action. What the driver does with the data is its own business. Writing
serial port, converted into a sound. Reading a byte from a device might cause the
serial port to wait for input, might return a random byte. The name “character
device” comes from the fact that each character is handled individually.
56
Device controllers
A device controller is a part of a computer system that makes sense of the signals
A device controller is a part of a computer system that makes sense of the signals
going to, and coming from the CPU processor. There are many device controllers in
and socket, and the socket is connected to a device controller. Device controllers
There are many device controllers in a computer system. Any device connected to
the computer is connected by a plug and socket, and the socket is connected to a
device controller. A computer system contains a many types of I/O devices and their
respective controllers.
Network card
Graphics adapter
Disk controller
DVD-ROM controller
Serial port
USB
Sound card
57
58
Device drivers
A device driver is a program that controls a particular type of device that is attached
to your computer. There are device drivers for printers, displays, CD-ROM readers,
diskette drives, and so on. When you buy an operating system, many device drivers
are built into the product. However, if you later buy a new type of device that the
operating system didn't anticipate, you'll have to install the new device driver. A
59
device driver essentially converts the more general input/output instructions of the
who comprehend the detailed knowledge of the device’s command language and
characteristics and contains the specific machine language necessary to perform the
functions requested by the application. When a new hardware device is added to the
computer, such as a CD-ROM drive, a printer, or a sound card, its driver must be
installed in order to run it. The operating system calls the driver, and the driver
operations for a particular hardware device. Device drivers can also be software-
only, emulating a device that exists only in software, such as a RAM disk or a
pseudo-terminal.
A device driver contains all the device-specific code necessary to communicate with
a device and provides a standard set of interfaces to the rest of the system. This
interface protects the kernel from device specifics just as the system call interface
the rest of the kernel need little (if any) device-specific code to address the device.
In this way, device drivers make the system more portable and easier to maintain.
60
There are several kinds of device drivers, each handling a different kind of I/O.
Block device drivers manage devices with physically addressable storage media,
such as disks. All other devices are considered character devices. Two types of
character device drivers are standard character device drivers and STREAMS
device drivers.
Devices that support a file system are known as block devices. Drivers written for
these devices are known as block device drivers. Block device drivers can also
provide a character driver interface that allows utility programs to bypass the file
system and access the device directly. This device access is commonly referred to
Character device drivers normally perform I/O in a byte stream. They can also
provide additional interfaces not present in block drivers, such as I/O control (ioctl)
Byte-Stream I/O
The main task of any device driver is to perform I/O, and many character device
drivers do what is called byte-stream or character I/O. The driver transfers data to
and from the device without using a specific device address. This is in contrast to
61
block device drivers, where part of the file system request identifies a specific
For certain devices, such as frame buffers, it is more efficient for application
programs to have direct access to device memory. Applications can map device
STREAMS Drivers
STREAMS are a separate programming model for writing a character driver. Devices
that receive data asynchronously (such as terminal and network devices) are suited
The driver is the link between the operating system and the peripheral
device.
A device driver sets the direct memory access control registers to use
Direct memory access (DMA) is a method that allows an input/output (I/O) device to
send or receive data directly to or from the main memory, bypassing the CPU to
62
controller (DMAC).
DMA channels are used to communicate data between the peripheral device and the
system memory. All four system resources rely on certain lines on a bus. Some lines
on the bus are used for IRQs, some for addresses (the I/O addresses and the
A DMA channel enables a device to transfer data without exposing the CPU to a work
overload. Without the DMA channels, the CPU copies every piece of data using a
peripheral bus from the I/O device. Using a peripheral bus occupies the CPU during
the read/write process and does not allow other work to be performed until the
operation is completed.
With DMA, the CPU can process other tasks while data transfer is being performed.
The transfer of data is first initiated by the CPU. During the transfer of data between
the DMA channel and I/O device, the CPU performs other tasks. When the data
transfer is complete, the CPU receives an interrupt request from the DMA controller.
63
Advantages of DMA
• DMA allows for faster processing since the processor can be working on
Disadvantages of DMA
• DMA transfer requires a DMA controller to carry out the operation, hence cost
64
Device independence
The principle of device independence works very well with respect to random
upward cares what kind of storage device it's reading from/ writing to.
Uniform naming
Recall that we discussed the value of the name space implemented by file systems.
There is no dependence between the name of the file and the device on which it is
stored.
Device independence
Uniform naming
Error handling
Interrupt Handler
interruption of the current code the processor is executing. Interrupt handlers have
65
a multitude of functions, which vary based on the reason the interrupt was generated
and the speed at which the interrupt handler completes its task. An interrupt
either hardware interrupts or interrupt instructions in software, and are used for
Types of Interrupts
External Interrupt
The external interrupt occurs when any input and output device request for any
operation and the CPU will execute that instructions first for example when a
program is executed and when we move the mouse on the screen then the CPU will
handle this external interrupt first and after that he will resume with his operation.
Internal interrupt
The internal interrupts are those which are occurred due to some problem in the
execution for example when a user performing any operation which contains any
error and which contains any type of error. So that internal interrupts are those
which are occurred by the some operations or by some instructions and the
operations those are not possible but a user is trying for that operation.
Software interrupt
66
Software interrupts are those which are made some call to the system for example
while we are processing some instructions and when we want to execute one more
application programs.
Functions
ii. Buffering
Uniform interfacing
Make all I/O devices look more or less the same, so that the O/S doesn’t need to be
Buffering
Memory area that stores data in kernel space while transferred between device and
application. Buffering allows the I/O devices to cope with a speed mismatch
67
between producers and consumers. Allows adaption between services with different
data-transfer sizes.
68
69
Disk hardware
70
Disk Scheduling
Servicing the disk I/O requests. Disk scheduling is the problem of deciding which
particular request for data by your computer from your hard drive should be
serviced first. In other words, when several programs are trying to pull data from
your hard drive at once, which one gets the data first? It is a fundamental problem in
operating system scheduling in terms of minimizing the wait for the user when he or
she simply wants to do some things that require information from the hard drive.
71
I/O request issues a system call to the OS. If desired disk drive or controller is
available, request is served immediately. If busy, new request for service will be
placed in the queue of pending requests. When one request is completed, the OS
In this jobs or processes are executed in the manner in which they are entered into
the computer. In this operating system creates a queue which contains the sequence
order in which they are to be executed and the sequence in which the CPU will
execute the process. In this all the jobs are performed according to their sequence
order as they have entered. In this the job which had requested first will firstly
performed by the CPU and the jobs those are entered later will be executed in to
72
In this technique the operating system will search for the shortest time means this
will search which job will takes a less time of CPU for running. After examining all
the jobs, all the jobs are arranged in the sequence wise or they are organized into
the priority order. The priority of the process will be the total time which a process
will use for execution. The shortest seek time will include all the time means time to
enter and time to completion of the process. Means the total time which a process
C-Scan Scheduling
In the c-scan all the processes are arranged by using some circular list. Circular list
is that in which there is no start and end point of the list means the end of the list is
the starting point of the list. In the c-scan scheduling the cpu will search for the
process from start to end and if an end has found then this again start from the
starting process. Because many times when a CPU is executing the processes then
73
may a user wants to enter some data means a user wants to enter some data so that at
that situation the CPU will again execute that process after the input operation. So
that c-scan scheduling is used for processing same processes again and again.
Look Scheduling
In the Look Scheduling the CPU Scans the List from Starting to End of the Disk in
which the various processes are running and in the Look Scheduling the CPU will
Scan the Entire Disk from one End to the Second end.
Round Robin
In the Round Robin Scheduling the Time of CPU is divided into the Equal Numbers
which is also called as Quantum Time. Each Process which is Request for Execution
will Consumes the Equal Number of Times of the CPU and after the Quantum Time of
First Process, the CPU will automatically goes to the Next Process. But the Main
Problem is that after the Completion of the Process the Time Will also be Consumed
by the Process. Means if a Process either or not have Some Operations To perform
74
the Time of CPU will also be Consume by the CPU , So this is the Wastage of the Time
of the CPU.
Priority Scheduling
In this Each Process have Some Priorities Assign to them, Means each and Every
Process will be examined by using the Total Time Which will be consumed by the
Process. The Total Time of the Process, and Number of times a Process needs Some
Input and Output and Number of Resources will be Examines to set the Priorities of
the Processes. So that all the Processes are arranged into the Form of these Criteria’s
Multilevel Queue
The multilevel queue is used when there are multiple queues for the various
different processes as we know that there are many different types of works those
are to be performed on the computers at a time. So that for organizing the various or
different types of queues the CPU maintains the queues by using this technique. In
this all the queues are collected and organized in the form of some functions which
they are requesting to perform. So that the various types of queues are maintained
SCAN
Go from the outside to the inside servicing requests and then back from the outside
75
The drive head sweeps across the entire surface of the disk, visiting the
innermost cylinders. It selects the next waiting requests whose location it will
reach on its path backwards and forwards across the disk. Thus, the movement
time should be less than FCFS but the policy is clearly fairer than SSTF.
C-LOOK
i. Moves inwards servicing requests until there are no more requests in that
iii. Variant: service requests from inside to outside, then skip back to the
innermost request.
Based on C-SCAN, C-LOOK involves the drive head sweeping across the disk
satisfying requests in one direction only. As in LOOK the drive makes use of the
location of waiting requests in order to determine how far to continue a sweep, and
where to commence the next sweep. Thus it may curtail a sweep towards the outer
edge when there are locations requested in cylinders beyond the current position,
and commence its next sweep at a cylinder which is not the innermost one, if that is
76
Disk bandwidth
Is the total number of bytes transferred, divided by the total time between the first
Seek time
Is the time for the disk are to move the heads to the cylinder containing the desired
sector.
Rotational latency
This is the additional time waiting for the disk to rotate the desired sector to the disk
head.
77
SCAN Scheduling
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
algorithm.
Error handling
There are several aspects to error handling including: detection, correction (if
ii. Correction is sometimes easy, for example ECC (error correcting code)
memory does this automatically (but the OS wants to know about the error so
iii. Error reporting tends to be awful. The trouble is that the error occurs at a low
level but by the time it is reported the context is lost. Unix/Linux in particular
78
Primary handling is by the drivers. It can often react and repair the error before the
software layer above notices. Only when, after several tries, repairing fails, the
higher layers are informed. Error handling at higher levels depends on the
Block will be marked “bad” and replaced by a spare block (this my interfere
Controller error
Controller is a parallel system, can get confused, driver may perform a reset
79
storage hierarchy, its operating system, networks, and databases. Caching improves
access time and reduces data traffic to data sources that have limited throughput. For
most of this web page only reads are considered. A section at the end deals with
RAM Disks
Refers to RAM that has been configured to simulate a disk drive. You can access files
on a RAM disk as you would access files on a real disk. RAM disks, however, are
approximately a thousand times faster than hard disk drives. They are particularly
useful, therefore, for applications that require frequent disk accesses. Because they
are made of normal RAM, RAM disks lose their contents once the computer is turned
off. To use a RAM disk, therefore, you need to copy files from a real hard disk at the
beginning of the session and then copy the files back to the hard disk before you
turn the computer off. Note that if there is a power failure, you will lose whatever
data is on the RAM disk. A RAM disk is also called a virtual disk or a RAM drive.
Clock hardware
• One shot mode: clock counts down from register value once and
clock tics)
• Ranges: e.g. 1000 MHz clock with a 16 bits register can fix time
Clock software
Calculate the exact time between two tics and adjust the clock on each
interrupt.
81
to running process)
Watchdog timers
– Watchdog timers start user specified routine after the time has elapsed
Profiling
Terminal hardware
– Industrial applications
• Memory-mapped interfaces
– character oriented
– Bitmapped
• Network computers
82
interface cards
• Driver writes characters to interface card which transforms them into a bit
sequence
• Interface cards may have a CPU on board, and be able to serve more
terminals
the RS UART
83
• Monitor talks pixels, video controller modulates the electron ray or steers the
lc’s
– Characters will typically be read 14 times, for each line on the screen in
Input software
– Raw mode:
– Cooked mode
84
• Nowadays, window driven applications use raw mode at the lowest level and
buffer (problem with real time level of the driver, safer if the
table
• Echoing is (was) done by the OS, or the shell. May be confusing for the user.
cursor back to the beginning of the line and a LF to go to the next one
85
– Timing of CR and LF
– Padding
example vt100)
86
Output software
• Serial terminals have an output buffer to which characters are sent until it is
full or until a line ends. Once full, the real output is initiated and the driver
special registers (e.g. register with the position of the top line)
UNIX/LINUX
87
Buffer Cache
Virtual Devices
hardware device by tricking the computer into thinking something exists when it
efficiency by printing to a file and the actual print off can take place when system is
quiet.
Most common example is print spooler; fax software can act as a virtual printer.
When print is selected, the document is sent to a fax/modem, which then sends
88
Spooling
device, program or the system. Data is sent to and stored in memory or other
temporary storage area, a special area in memory or on a disk where a device can
access them when it is ready. Spooling is useful because devices access data at
different rates.
The buffer provides a waiting station where data can rest while the slower device
catches up. However, unlike a spool of thread, the first jobs sent to the spool are the
The most common spooling application is print spooling. When you choose to print a
document, the computer sends the document information to the printer very quickly,
but the printer can't accept it at the same rate. The printer can only handle a chunk of
information at a time, and it pauses to process and print that chunk before it's ready
for more. Meanwhile, you have to wait until the printer has accepted the whole
document, piece by piece, before you can use your computer again because the
89
Spooling Technique
• A high speed device like a disk is interposed between a running program and
isolated
90
Advantages
Buffering
Small amount of memory used for temporary storage of data, usually to compensate
device (computer) dumps the data which is then 'trickled' to the slower one (printer).
Buffering is also required where a constant high bit rate has to be maintained, such
audio/video files.
A buffer is an area of main memory for holding data during input and output data
transfers. A temporary storage area, usually in RAM. The purpose of most buffers is
to act as a holding area, enabling the CPU to manipulate data before transferring it to
a device. Because the processes of reading and writing data to a disk are relatively
slow, many programs keep track of data changes in a buffer and then copy the
buffer to a disk. For example, word processors employ a buffer to keep track of
changes to files. Then when you save the file, the word processor updates the disk
91
file with the contents of the buffer. This is much more efficient than accessing the file
• After the data have been read and the CPU is about to start the operation, the
• By the time CPU is ready for next operation, the input device would have
finished reading it
• CPU creates data and puts into a buffer until an output device can accept it
Output Buffering
Input Buffering
92
• After the data transfer, the processor access the data from the buffer
Advantages
data streams
Caching
storage of data for processing or the data frequently requested from the computer's
hard disk. Since data stored in RAM can be accessed much faster than the data
93
Process management
Process levels
Process states/models
94