0% found this document useful (0 votes)
13 views

BCA OS Unit4

The document discusses file systems, including file concepts, access methods, and directory structures. It covers file attributes, operations, and protection mechanisms, as well as directory implementation and allocation methods for efficient file management. Additionally, it addresses free space management techniques to track and allocate disk space effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

BCA OS Unit4

The document discusses file systems, including file concepts, access methods, and directory structures. It covers file attributes, operations, and protection mechanisms, as well as directory implementation and allocation methods for efficient file management. Additionally, it addresses free space management techniques to track and allocate disk space effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

UNIT-IV

File-System Interface: File Concept, Access Methods, Directory and Disk Structure, Protection.
File-System Implementation: File-System Structure, File-System Implementation, Directory
Implementation, Allocation Methods, Free-Space Management, Efficiency and Performance.
I/O Systems: Overview, Application I/O Interface, Kernel I/O Subsystem, Transforming I/O
Requests to Hardware Operations.

FILE SYSTEMS
Files are logical units of information created by processes. Processes can read existing files and
create new ones if need be. Information stored in files must be persistent, that is, not be affected by
process creation and termination. A file should disappear only when its owner explicitly removes it.

File Naming

A file is an abstraction mechanism. It provides a way to store information on the disk and read it
back later. When a process creates a file, it gives the file a name. When the process terminates, the
file continues to exist and can be accessed by other processes using its name.
The exact rules for file naming vary somewhat from system to system, but all current operating
systems allow strings of one to eight letters as legal file names.
Some file systems distinguish between uppercase and lowercase letters, whereas others do not.
UNIX falls in the first category; the old MS-DOS falls in the second. UNIX system can have all of
the following as three distinct files: nishitha, Nishitha, and NISHITHA. In MS-DOS, all these names
refer to the same file.

Many operating systems support two-part file names, with the two parts separated by a period,
as in prog.cpp. Some of the more common file extensions and their meanings are shown below.

Extension Meaning

.bak Backup file

.cpp CPP source program

.gif Graphical Interchange Format image

.hlp Help file

.html World Wide Web Hypertext Markup Language document

.jpg Still picture encoded with the JPEG standard


.mp3 Music encoded in MPEG layer 3 audio for mat

.mpg Movie encoded with the MPEG standard

.pdf Portable Document Format file

.txt General text file

.zip Compressed archive

Figure 4-1. Some typical file extensions.

File Access Methods


Early operating systems provided only one kind of file access: sequential access. In these
systems, a process could read all the bytes or records in a file in order, starting at the beginning.
Sequential files were convenient when the storage medium was magnetic tape rather than disk.

When disks came into use for storing files, it became possible to read the bytes or records of a
file out of order or to access records by key rather than by position. Files whose bytes or records can
be read in any order are called random-access files.

File Attributes

Every file has a name and its data. In addition, all operating systems associate other information
with each file, for example, the date and time the file was last modified and the file’s size. We will
call these extra items as the file’s attributes.

File Operations

Files exist to store information and allow it to be retrieved later. Different systems provide
different operations to allow storage and retrieval. The most common system calls relating to files
are: Create, Delete, Open, Close, Read, Write, Append, Seek, Get attributes, Set attributes and
Rename.
DIRECTORIES:

To keep track of files, file systems normally have directories or folders, which are themselves
files.

Single-Level Directory Systems

The simplest form of directory system is having one directory containing all the files. Sometimes it
is called the root directory.

An example of a system with one directory is given in the following Fig. Here the directory
contains four files. The advantages of this scheme are its simplicity and the ability to locate files
quickly.

Hierarchical Directory Systems

Directory Operations

The allowed system calls for managing directories are Create, Delete, Opendir, Closedir,
Readdir, Rename, Link, Unlink.
File System Mounting

Mounting a file system attaches that file system to a directory (mount point) and makes it available
to the system. A file system must be mounted before it can be accessed. A unmounted file system
(i.e., Fig. 11-11(b)) is mounted at a mount point.

Protection

When information is stored in a computer system, we want to keep it safe from physical damage
(reliability) and improper access (protection). Reliability is generally provided by duplicate copies
of files.

Protection can be provided in many ways. For a small single-user system, we might provide
protection by physically removing the floppy disks and locking them in a desk drawer or file
cabinet. In a multiuser system, however, other mechanisms are needed.

Types of Access

The need to protect files is a direct result of the ability to access files. Systems that do not permit
access to the files of other users do not need protection. Thus, we could provide complete
protection by prohibiting access.

Alternatively, we could provide free access with no protection. What is needed is controlled
access.

Several different types of operations may be controlled:

• Read: Read from the file.

• Write: Write or rewrite the file.


• Execute: Load the file into memory and execute it.

• Append: Write new information at the end of the file.

• Delete: Delete the file and tree its space for possible reuse.

• List: List the name and attributes of the file. Other operations, such as renaming, copying, and

editing the file, may also be controlled.

Access Lists and Groups


Mode of access: read, write, execute

Three classes of users on Unix / Linux

RWX

a) owner access 7 Þ 1 1 1
RWX

b) group access 6 Þ 1 1 0

RWX

c) public access 1 Þ 0 0 1

Directory Implementation

There is the number of algorithms by using which, the directories can be implemented. However,
the selection of an appropriate directory implementation algorithm may significantly affect the
performance of the system.

The directory implementation algorithms are classified according to the data structure they are
using. There are mainly two algorithms which are used in these days.

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.
2. Hash Table

This approach use a 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.

Searching becomes efficient due because only hash table entries are checked using the key and if an
entry found then the corresponding file will be fetched using the value.

Allocation Methods
Allocation method provides a way in which the disk will be utilized and the files will be accessed.
Allocation method will significantly affect the performance and efficiency of the system. The
following methods are used for allocation.

1. Contiguous Allocation.
2. Extents
3. Linked Allocation
4. Clustering
5. FAT
6. Indexed Allocation
7. Linked Indexed Allocation
8. Multilevel Indexed Allocation
9. I-node
Free Space Management

A file system is responsible to allocate the free blocks to the file therefore it has to keep track of all
the free blocks present in the disk. There are mainly two approaches by using which, the free blocks
in the disk are managed.

1. Bit Vector

In this approach, the free space list is implemented as a bit map vector. It contains the number of
bits where each bit represents each block.

If the block is empty then the bit is 1 otherwise it is 0. Initially all the blocks are empty therefore
each bit in the bit map vector contains 1.

2. Linked List

It is another approach for free space management. This approach suggests linking together all the
free blocks and keeping a pointer which points to the first free block.

Therefore, all the free blocks on the disks will be linked together with a pointer. Whenever a block
gets allocated, its previous free block will be linked to its next free block.

You might also like