Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

OS main concepts

Rating
-
Sold
-
Pages
31
Uploaded on
31-07-2025
Written in
2024/2025

Many things u can find in this notes of various topics for the subject of OS

Institution
Course

Content preview

UNIT-IV

FILE SYSTEMS
File Systems:

The file system is the most visible aspect of an operating system. It provides the mechanism for on-
line storage of and access to both data and programs of the operating system and all the users of the
computer system. The file system consists of two distinct parts: a collection of files, each storing
related data, and a directory structure, which organizes and provides information about all the files in
the system.

Concept of a File: Computers can store information on various storage media, such as magnetic
disks, magnetic tapes, and optical disks. So that the computer system will be convenient to use, the
operating system provides a uniform logical view of stored information. The operating system
abstracts from the physical properties of its storage devices to define a logical storage unit is file.

File: A file is a collection of related information that is recorded on secondary storage. From the
user’s perspective, a file is the smallest allotment of logical secondary storage.

The information in a file is defined by its creator. Many different types of information may be
stored in a file— source or executable programs, numeric or text data, photos, music, video, and so
on. A file has a certain defined structure, which depends on its type.

Mainly three types of files are there, they are
Text file: is a sequence of characters organized into lines (and possibly pages).
Source file: is a sequence of functions, each of which is further organized as declarations followed by
executable statements.
Executable file: is a series of code sections that the loader can bring into memory and
execute.

The name of the file is divided into two parts as shown below:
● name
● extension, separated by a period.

File Attributes: A file’s attributes vary from one operating system to another but
typically consist of these:

• Name. The symbolic file name is the only information kept in human- readable form.
• Identifier. This unique tag, usually a number, identifies the file within the file system; it is the
non-human-readable name for the file.
• Type. This information is needed for systems that support different types of files.
• Location. This information is a pointer to a device and to the location of the file on that device.
• Size. The current size of the file (in bytes, words, or blocks) and possibly the maximum allowed
size are included in this attribute.
• Protection. Access-control information determines who can do reading, writing, executing, and
so on.
• Time, date, and user identification. This information may be kept for creation, last
modification, and last use. These data can be useful for protection, security, and usage
monitoring.

Some newer file systems also support extended file attributes, including character
encoding of the file and security features such as a file checksum. Figure




1

,illustrates a file info window on Mac OS X, which displays a file’s attributes.

File Directories:
The collection of files is a file directory. The directory contains information about the files,
including attributes, location, and ownership. Much of this information, especially that is
concerned with storage, is managed by the operating system. The directory is itself a file,
accessible by various file management routines.

Below are information contained in a device directory.
● Name
● Type
● Address
● Current length
● Maximum length
● Date last accessed
● Date last updated
● Owner id
● Protection information

The operation performed on the directory are:
● Search for a file
● Create a file
● Delete a file
● List a directory




2

, ● Rename a file
● Traverse the file system
Advantages of Maintaining Directories:
● Efficiency: A file can be located more quickly.
● Naming: It becomes convenient for users as two users can have same name for
different files or may have different name for same file.
● Grouping: Logical grouping of files can be done by properties e.g. all java
programs, all games etc.

File Operations:
A file is an abstract data type. To define a file properly, we need to consider the
operations that can be performed on files. The operating system can provide system
calls to create, write, read, reposition, delete, and truncate files. Let’s examine what the
operating system must do to perform each of these six basic file operations. It should
then be easy to see how other similar operations, such as renaming a file, can be
implemented.
• Creating a file. Two steps are necessary to create a file. First, space in the file
system must be found for the file. Second, an entry for the new file must be made in
the directory.
• Writing a file. To write a file, we make a system call specifying both the name of
the file and the information to be written to the file. Given the name of the file, the
system searches the directory to find the file’s location. The system must keep a
write pointer to the location in the file where the next write is to take place. The
write pointer must be updated whenever a write occurs.
• Reading a file. To read from a file, we use a system call that specifies the name of
the file and where (in memory) the next block of the file should be put. Again, the
directory is searched for the associated entry, and 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. Because a process is usually either
reading from or writing to a file, the current operation location can be kept as a per-
process current- file-position pointer. Both the read and write operations use this
same pointer, saving space and reducing system complexity.
• Repositioning within a file. The directory is searched for the appropriate entry, and
the current-file-position pointer is repositioned to a given value. Repositioning
within a file need not involve any actual I/O. This file operation is also known as a
file seek.
• Deleting a file. To delete a file, we search the directory for the named file. Having
found the associated directory entry, we release all file space, so that it can be reused
by other files, and erase the directory entry.
• Truncating a file. The user may want to erase the contents of a file but keep its
attributes. Rather than forcing the user to delete the file and then recreate it, this
function allows all attributes to remain unchanged— except for file length— but lets
the file be reset to length zero and its file space released.
Most OSes require that files be opened before access and closed after all access is
complete. Normally the programmer must open and close files explicitly, but some rare
systems open the file automatically at first access. Information about currently open
files is stored in an open file table, containing for example:
● File pointer - records the current position in the file, for the next read or write
access.
● File-open count - How many times has the current file been opened
(simultaneously by different processes) and not yet closed? When this counter
reaches zero the file can be removed from the table.




3

, ● Disk location of the file: Most file operations require the system to modify data within
the file. The information needed to locate the file on disk is kept in memory so that the
system does not have to read it from disk for each operation.

● Access rights: Each process opens a file in an access mode. This information is stored on
the per-process table so the operating system can allow or deny subsequent I/O requests.

Some systems provide support for file locking.

⮚ A shared lock is for reading only.
⮚ A exclusive lock is for writing as well as reading.
⮚ An advisory lock is informational only, and not enforced. (A "Keep Out" sign,
which may be ignored.)
⮚ A mandatory lock is enforced. (A truly locked door.)
⮚ UNIX used advisory locks, and Windows uses mandatory locks

File Types: A common technique for implementing file types is to include the type as part of the
file name. The name is split into two parts — a name and an extension, usually separated by a period
(Figure 11.3).




In this way, the user and the operating system can tell from the name alone what the type of a file is.
Most operating systems allow users to specify a file name as a sequence of characters followed by a
period and terminated by an extension made up of additional characters.

● Macintosh stores a creator attribute for each file, according to the program that first created it
with the create () system call.
● UNIX stores magic numbers at the beginning of certain files. (Experiment with the "file"
command, especially in directories such as /bin and /dev)




4

Written for

Course

Document information

Uploaded on
July 31, 2025
Number of pages
31
Written in
2024/2025
Type
Class notes
Professor(s)
Lingaiah
Contains
All classes

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
gayathrisriyellavula

Also available in package deal

Get to know the seller

Seller avatar
gayathrisriyellavula Marri Laxman Reddy institute of technology
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
9 months
Number of followers
0
Documents
9
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions