0% found this document useful (0 votes)
13 views27 pages

Oschapter 8

Chapter 8 discusses file systems, defining a file as a named collection of related information stored on secondary storage. It covers file attributes, operations, access mechanisms, and types of file systems, including disk-based and network file systems. Additionally, it addresses file sharing, protection, and the implementation of file system layers and structures.

Uploaded by

hirpaadugna1
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)
13 views27 pages

Oschapter 8

Chapter 8 discusses file systems, defining a file as a named collection of related information stored on secondary storage. It covers file attributes, operations, access mechanisms, and types of file systems, including disk-based and network file systems. Additionally, it addresses file sharing, protection, and the implementation of file system layers and structures.

Uploaded by

hirpaadugna1
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/ 27

Chapter -8

File systems
File concept
• A file is a named collection of related information
that is recorded on secondary storage such as
magnetic disks, magnetic tapes and optical disks.
• Types:
• numeric
• character
• binary
• Program Contents defined by file’s creator and more
Consider text file, source file, executable file
File Attributes
It describes the properties of file.
• Name – only information kept in human-readable form
• Identifier – unique tag (number) identifies file within file system
• Type – needed for systems that support different types
• Location – pointer to file location on device
• Size – current file size
• Protection – controls who can do reading, writing, executing
• Time, date, and user identification – data for protection, security,
and usage monitoring
Information about files are kept in the directory structure, which is
maintained on the disk
File Operations
File operations are the basic actions that an operating system (OS)
allows users to perform on files stored in a file system.
File operations are:-
• Create
• Open
• Write – at write pointer location
• Read – at read pointer location
• Reposition within file - seek
• Delete
• Rename
• copy
• append
• Truncate (removing the file contents without deleting the file)
• Close
File Access Mechanisms
File access mechanism refers to the manner in which
the records of a file may be accessed. There are
several ways to access files −
Sequential access
Direct/Random access
Indexed sequential access
1.Sequential access
• A sequential access is that in which the records
are accessed in some sequence, i.e., the
information in the file is processed in order, one
record after the other
2.Direct/Random access
• Random access file organization provides, accessing the
records directly.
• Each record has its own address on the file with by the
help of which it can be directly accessed for reading or
writing.
• The records need not be in any sequence within the file
and they need not be in adjacent locations on the
storage medium.
3.Indexed sequential access
• This mechanism is built up on base of sequential
access.
• An index is created for each file which contains
pointers to various blocks.
• Index is searched sequentially and its pointer is
used to access the file directly.
Types of File Systems
• A file system is a method an operating system uses to store, organize, and
manage files and directories on a storage device.
• File system has different types:-
 Disk-Based File Systems
 Network File Systems
 Special-Purpose File Systems
• Some common disk-Based File Systems are:-
• FAT (File Allocation Table): An older file system used by older versions of
Windows and other operating systems.
• NTFS (New Technology File System): A modern file system used by Windows. It
supports features such as file and folder permissions, compression, and
encryption.
• ext (Extended File System): A file system commonly used on Linux and Unix
operating systems.
• HFS (Hierarchical File System): A file system used by macOS.
• APFS (Apple File System): A new file system introduced by Apple for their Macs
and iOS devices.
Network File Systems
Used to access files over a network.
• NFS (Network File System)
- used for Linux/Unix networks.
• SMB/CIFS (Server Message Block / Common Internet File System)
- used for Windows networks.
Special-Purpose File Systems
Optimized for particular devices or uses.
ISO 9660 / UDF (Universal Disk Format) - Used for CDs and DVDs.
TMPFS (Temporary File System) -Stores files in RAM.
File Locking
Provided by some operating systems and file systems
• Similar to reader-writer locks
• Shared lock similar to reader lock – several processes
can acquire concurrently
• Exclusive lock similar to writer lock Mediates access to
a file
• Mandatory or advisory:
• Mandatory – access is denied depending on locks held
and requested
• Advisory – processes can find status of locks and decide
what to do
File Types – Name, Extension
Directory Structure
• A collection of nodes containing information
about all files
Operations Performed on Directory
• Search for a file
• Create a file
• Delete a file
• List a directory
• Rename a file
• Traverse the file system
Directory Organization
Advantages of Maintaining Directories are:-
• Efficiency – locating a file quickly
• Naming – convenient to users
 Two users can have same name for different files
 The same file can have several different names
• Grouping – logical grouping of files by
properties, (e.g., all Java programs, all games,
…)
File Sharing
• file can be shared between multiple users.
• Sharing may be done through a protection scheme
• On distributed systems, files may be shared across a
network
• Network File System (NFS) is a common distributed file-
sharing method
File Sharing in Multi-User Systems:-
• User IDs identify users, allowing permissions and protections to be
per-user
• Group IDs allow users to be in groups, permitting group access
rights
• Directories and files have owners and groups that determine
access rights.
File Sharing – Remote File Systems
This techniques uses networking to allow file system access between
systems
• Manually via programs like FTP
• Automatically, seamlessly using distributed file systems
• Semi automatically via the world wide web
• Client-server model allows clients to mount remote file systems from
servers
• Server can serve multiple clients
• NFS is standard UNIX client-server file sharing protocol
•CIFS(Common Internet FS) is standard Windows protocol
• Standard operating system file calls are translated into remote calls
• Distributed Information Systems (distributed naming services) such as
LDAP, DNS, NIS, Active Directory implement unified access to
information needed for remote computing
File Sharing – Failure Modes
• All file systems have failure modes
• For example corruption of directory structures or other non-user data,
called metadata
• Remote file systems add new failure modes, due to network failure, server
failure
• • Recovery from failure can involve state information about status of each
remote request. In tasteful recovery, the server keeps track of sessions,
open files, and locks. In tasteful recovery mechanism are:-
– Client reconnects to server.
– Re-authenticate as user.
– Re-open file.
– Retry the operation.
• Stateless protocols such as NFS v3 include all information in each request,
allowing easy recovery but less security. In this state The server does not
remember anything. Recovery mechanism is try again and again by
including needed information.
Protection
• File owner/creator should be able to control:
what can be done
by whom
• Types of access
Read
Write
Execute
Append
Delete
List
Access Lists and Groups
• Mode of access: read, write, execute
• Three classes of users on Unix / Linux
RWX
– a) owner access 7 111
RWX
– b) group access 6 110
RWX
– c) public access 1 001
A Sample UNIX Directory Listing
File System Layers
File system layers refer to the different levels of abstraction and
functionality in a computer's file system. Each layer is
responsible for specific tasks, working together to manage how
data is stored, organized, and accessed on storage devices.
Common File System Layers
1. Application Layer
• Interacts with user programs and system utilities.
• Provides APIs for file operations (open, read, write, close)
2.Logical File System
– Manages metadata (file names, permissions, directories).
– Handles file organization and directory structure.
File System Layers
3.File Organization Module
– Translates logical file operations into physical storage
operations.
– Manages file allocation and free space.
4. Basic File System
– Issues generic commands to the device driver.
– Handles buffering and caching.
• 5. I/O Control Layer (Device Drivers)
– Converts generic file system operations into device-specific
commands.
– Communicates directly with hardware.
6. Physical File System (Hardware)
– The actual storage medium (HDD, SSD, etc.).
– Stores the raw bits and bytes.
File-System Implementation
• System calls are available at the API level, but how are
their functions actually implemented?
• Both on-disk and in-memory structures are used.
• The boot control block contains information needed by
the system to boot the operating system from that
volume.
• This block is required if the volume contains an OS and is
usually located in the first block of the volume.
• The volume control block (also known as the superblock
or master file table) contains details about the volume.
• It stores information such as the total number of blocks,
the number of free blocks, block size, and pointers or an
array for free blocks.
In-Memory File System Structures
• Mount table storing file system mounts, mount points,
file system types
• The following figure illustrates the necessary file
system structures provided by the operating systems
• Figure 12-3(a) refers to opening a file
• Figure 12-3(b) refers to reading a file
• Plus buffers hold data blocks from secondary storage
• Open returns a file handle for subsequent use
• Data from read eventually copied to specified user
process memory address
yo u
n k
h a
T

You might also like