0% found this document useful (0 votes)
14 views34 pages

Group 4 OS Work

The document presents an overview of operating systems focusing on file management, I/O hardware, and principles of I/O software. It covers topics such as file concepts, operations, types, directory structures, allocation methods, and I/O control mechanisms. Additionally, it discusses the roles of device drivers, interrupt handlers, and the kernel I/O subsystem in managing input/output operations.

Uploaded by

markkifunye159
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)
14 views34 pages

Group 4 OS Work

The document presents an overview of operating systems focusing on file management, I/O hardware, and principles of I/O software. It covers topics such as file concepts, operations, types, directory structures, allocation methods, and I/O control mechanisms. Additionally, it discusses the roles of device drivers, interrupt handlers, and the kernel I/O subsystem in managing input/output operations.

Uploaded by

markkifunye159
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/ 34

GROUP FOUR OPERATING SYSTEMS PRESENTATION.

File Management: Concept of File, Access methods, File types, File operation,
Directory structure, File System structure, Allocation methods (contiguous,
linked, indexed), Free-space management (bit vector, linked list, grouping),
directory implementation (linear list, hash table), efficiency and performance.
I/O Hardware: I/O devices, Device controllers, Direct memory access
Principles of I/O Software: Goals of Interrupt handlers, Device drivers,
Device independent I/O software.
GROUP MEMBERS

NAMES REGISTRATION NUMBER


GIMONO GRACE BU/UG/2023/2337
KADOLI JACKSON BU/UP/2023/3637
OTIM DANIEL BU/UP/2023/0972
KEMIGISA NOELINE BU/UP/2023/0954
OLWENYI LAMU BU/UP/2023/0969
FILE.
FILE CONCEPT.
Computers can store information on various storage media such as, magnetic disks,
magnetic tapes, optical disks. The physical storage is converted into a logical
storage unit by operating system
A file: is a collection of similar records. A record is a collection of related fields that can be
treated as a unit by some application program.

NAME ENGLISH MATHS Fail/Pas

JOSEPH 85 86 P

DANIEL 93 92 P
File attributes.
1. Name: A file is named for the convenience of the user and is referred by its name. A name is
usually a string of characters.
2. Identifier: This unique tag, usually a number identifies the file within the file system.
3. Type: Files are of so many types. The type depends on the extension of the file.
 i.e
 .exe Executable file
 .obj Object file
 .src Source file
4. Location: This information is a pointer to a device and to the location of the file on that device.
5. Size: The current size of the file (in bytes, words, blocks).
6. Protection: Access control information determines who can do reading, writing, executing and
so on.

7.Time,Date,User,identification: This information may be kept for creation, last modification, last
use.
File operations.

1. Creating a file:
steps
 Check whether the space is available or not.
 If the space is available then made an entry for the new file in the directory. The entry includes name of
the file, path of the file, etc…
2. Writing a file: To write a file, we have to know 2 things. One is name of the file and second is the information or
data to be written on the file, the system searches the entire given location for the file. If the file is found, the
system must keep a write pointer to the location in the file where the next write is to take place.
3 .Reading a file: To read a file, first of all we search the directories for the file, if the file is found, the system needs
to keep a read pointer to the location in the file where the next read is to take place. Once the read has taken place,
the read pointer is updated.
4. Repositioning within a file: The directory is searched for the appropriate entry and the current file position
pointer is repositioned to a given value. This operation is also called file seek.
5. Deleting a file: To delete a file, first of all search the directory for named file, then released the file space and
erase the directory entry.
6. Truncating a file: To truncate a file, remove the file contents only but, the attributes are as it is.
File types
File Type Extension Purpose
Executable .exe Ready to run (or)
.com ready
.bin to run
machine

Source code .c Source code in


.cpp various
.asm languages.

Object .obj Compiled,


.o machine

Batch .bat Commands to


.sh the command
File structure

 File types also can be used to indicate the internal structure of the file. The operating system requires
that an executable file have a specific structure so that it can determine where in memory to load the
file and what the location of the first instruction is.
 INTERNAL FILE STRUCTURE.
 In UNIX OS, defines all files to be simply stream of bytes. Each byte is
individually addressable by its offset from the beginning or end of the file. In
this case, the logical record size is 1 byte. The file system automatically packs
and unpacks bytes into physical disk blocks, say 512 bytes per block.
FILE ACCESS METHODS

 Files stores information, this information must be accessed and read into computer memory
1.Sequential file access:
Information in the file is processed in order i.e. one record after the other.
Magnetic tapes are supporting this type of file accessing.
 Eg : A file consisting of 100 records, the current position of read/write head is 45th
record, suppose we want to read the 75th record then, it access sequentially from 45,
46, 47
 …….. 74, 75. So the read/write head traverse all the records between 45 to 75.
2.Direct access:
 Direct access is also called relative access. Here records can read/write randomly without any order. The
direct access method is based on a disk model of a file, because disks allow random access to any file
block
 Eg : CD consists of 10 songs, at present we are listening song 3, If we want to listen song 10,
we can shift to 10.
Continuation of file access methods.

Indexed Sequential File access.


 The main disadvantage in the sequential file is, it takes more time to access a Record
 .Records are organized in sequence based on a key
field. Eg :
 A file consisting of 60000 records, the master index divide the total
records into 6 blocks, each block consisting of a pointer to secondary
index. The secondary index divide the 10,000 records into 10 indexes.
Each index consisting of a pointer to its original location.
Directory structure.
 Sometimes the file system consisting of millions of files, at that situation it is very hard to manage the
files. To manage these files grouped these files and load one group into one partition.
 Each partition is called a directory
 OPERATION ON THE DIRECTORIES:
Search for a file: Search a directory structure for required file.

Create a file : New files need to be created, added to the directory.

Delete a file : When a file is no longer needed, we want to remove it from the directory.

List a directory: We can know the list of files in the directory.

Rename a file : Whenever we need to change the name of the file, we can change the name.
Traverse the file system : We need to access every directory and every file with in a directory structure we can
traverse the file system
Single level directory.

 The directory system having only one directory, it consisting of all files
sometimes it is said to be root directory.
Two level directory
 The problem in single level directory is different user may be
accidentally use the same name for their files. To avoid this
problem each user need a private directory,
 Names chosen by one user don't interfere with names chosen by a
different user.
Tree structured directory.
File system structure:
 Disk provides the bulk of secondary storage on which a file system is maintained. They have
2 characteristics that make them a convenient medium for storing multiple files.

1. A disk can be rewritten in place. It is possible to read a block from the disk, modify the block,
and write it back into same place.
2. A disk can access directly any block of information it contains.

Application Programs

Logical File System

File Organization Module

Basic File System

I/O Control

Devices
I/O control.
consists of device drivers and interrupt handlers to
transfer information between the main memory and
the disk system. The device driver writes specific
bit patterns to special locations in the I/O
controller’s memory to tell the controller which
device location to act on and what actions to take.
File System Implementation:
A Boot Control Block (per volume) can contain information
needed by the system to boot an OS from that volume. If the
disk does not contain an OS, this block can be empty.

A Volume Control Block (per volume) contains volume (or


partition) details, such as number of blocks in the partition, size
of the blocks, a free block, count and free block pointers, free
FCB count, FCB pointers.
Allocation Methods
– Contiguous
An allocation method refers to how disk blocks are allocated for
files:
Contiguous allocation – each file occupies set of
contiguous blocks of Best performance in most cases
o Simple – only starting location (block #) and length
(number of blocks) are required
o Problems include finding space for file,
knowing file size, external fragmentation, need
for compaction off-line (downtime) or on-line
Linked allocation
Linked allocation – each file a linked list of blocks of
File ends at nil pointer
o No external fragmentation
o Each block contains pointer to next block
o No compaction, external fragmentation
o Free space management system called when new block needed
o Improve efficiency by clustering blocks into groups but increases internal
fragmentation
o Reliability can be a problem
o Locating a block can take many I/Os and disk seeks FAT (File
Allocation Table) variation
o Beginning of volume has table, indexed by block number
Much like a linked list, but faster on disk and cacheable
Free-Space Management
File system maintains free-space list to
track available blocks/clusters Linked list
(free list)
o Cannot get contiguous space easily
o No waste of space
o No need to traverse the entire list
. Bitmap or Bit vector
A Bitmap or Bit Vector is series or collection of bits where each bit
corresponds to a disk block. The bit can take two values: 0 and 1: 0
indicates that the block is allocated and 1 indicates a free block.
Advantages –
 Simple to understand.
 Finding the first free block is efficient.
 It requires scanning the words (a group of 8 bits) in a bitmap for a non-zero word.
Grouping
Modify linked list to store address of next n-1 free
blocks in first free block, plus a pointer to next
block that contains free-block-pointers (like this
one).
An advantage of this approach is that the
addresses of a group of free disk blocks can be
found easily
counting
Because space is frequently contiguously used and
freed, with contiguous- allocation allocation, extents,
or clustering.
Keep address of first free block and count of
following free blocks. Free space list then has
entries containing addresses and counts.
Directory Implementation
1. Linear List
In this algorithm, all the files in a directory are maintained as singly lined list. Each
file contains the pointers to the data blocks which are assigned to it and the next file
in the directory.
Characteristics
1. When a new file is created, then the entire list is checked whether the new file name is
matching to a existing file name or not. In case, it doesn't exist, the file can be created at
the beginning or at the end. Therefore, searching for a unique name is a big concern
because traversing the whole list takes time.
2. The list needs to be traversed in case of every operation (creation, deletion, updating, etc)
on the files therefore the systems become inefficient.
Hash table.
To overcome the drawbacks of singly linked list implementation of directories, there is an
alternative approach that is hash table. This approach suggests to use hash table along with the
linked lists.
A key-value pair for each file in the directory gets generated and stored in the hash table. The
key can be determined by applying the hash function on the file name while the key points to
the corresponding file stored in the directory.
Now, searching becomes efficient due to the fact that now, entire list will not be searched on
every operating. Only hash table entries are checked using the key and if an entry found then
the corresponding file will be fetched using the value.
I/O Hardware: I/O devices
Input/output devices are the devices that are responsible for the input/output operations in a
computer system.
Basically there are following two types of input/output devices:
 Block devices
 Character devices
Block Devices
A block device stores information in block with fixed-size and own-address.
It is possible to read/write each and every block independently in case of block device.
In case of disk, it is always possible to seek another cylinder and then wait for required block to
rotate under head without mattering where the arm currently is. Therefore, disk is a block addressable
device. Character Devices

A character device accepts/delivers a stream of characters without regarding to any block structure.
Character device isn't addressable.
Character device doesn't have any seek operation.
There are too many character devices present in a computer system such as printer, mice, rats,
network interfaces etc.
Device Controllers
Device drivers are software modules that can be plugged into
an OS to handle a particular device. Operating System takes
help from device drivers to handle all I/O devices.
The Device Controller works like an interface between a device and a device
driver. I/O units (Keyboard, mouse, printer, etc.) typically consist of a
mechanical component and an electronic component where electronic component
is called the device controller
Synchronous vs asynchronous
 Synchronous I/OCPU execution waits while I/O proceeds
I/O − In this scheme
 Asynchronous I/O − I/O proceeds concurrently with CPU execution
Communication to I/O Devices

The CPU must have a way to pass information to and from an I/O
device. There are three approaches available to communicate with the
CPU and Device.
 Special Instruction I/O
 Memory-mapped I/O
 Direct memory access (DMA)
Direct Memory Access
(DMA)
Slow devices like keyboards will generate an interrupt to the main CPU
after each byte is transferred. If a fast device such as a disk generated an
interrupt for each byte, the operating system would spend most of its
time handling these interrupts. So a typical computer uses direct memory
access (DMA) hardware to reduce this overhead.
Direct Memory Access (DMA) means CPU grants I/O module authority to read from or write
to memory without involvement
Device Drivers
Device drivers are software modules that can be plugged into an OS to
handle a particular device. Operating System takes help from device drivers
to handle all I/O devices.
A device driver performs the following jobs −
 To accept request from the device independent software above to it.
 Interact with the device controller to take and give I/O and perform required error handling
 Making sure that the request is executed successfully
Interrupt handlers
An interrupt handler, also known as an interrupt service
routine or ISR, is a piece of software or more specifically a
callback functions in an operating system or more
specifically in a device driver, whose execution is triggered
by the reception of an interrupt.
Device-Independent I/O
Software
The basic function of the device-independent software is to perform
the I/O functions that are common to all devices and to provide a
uniform interface to the user-level software.
User-Space I/O Software
These are the libraries which provide richer and simplified interface to
access the functionality of the kernel or ultimately interactive with the
device drivers.
Kernel I/O Subsystem
Kernel I/O Subsystem is responsible to provide many services
related to I/O. Following are some of the services provided.
Scheduling − Kernel schedules a set of I/O requests to determine a
good order in which to execute them
Caching − Kernel maintains cache memory which is region of fast
memory that holds copies of data.
Spooling and Device Reservation − A spool is a buffer that holds
output for a device, such as a printer, that cannot accept interleaved
data streams.
THE END
THANK YOU.

You might also like