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

File System: M. S. Ramaiah Institute of Technology

This document discusses file systems and their interfaces. It covers key file system concepts like file attributes, operations, access methods, directory structures and protection. It describes how files are organized and managed through directories. Different directory structures are presented including single-level, two-level, tree-structured and graph-based designs. File access methods like sequential and direct access are defined. The document also discusses file protection through access rights and controls.

Uploaded by

Nishit
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

File System: M. S. Ramaiah Institute of Technology

This document discusses file systems and their interfaces. It covers key file system concepts like file attributes, operations, access methods, directory structures and protection. It describes how files are organized and managed through directories. Different directory structures are presented including single-level, two-level, tree-structured and graph-based designs. File access methods like sequential and direct access are defined. The document also discusses file protection through access rights and controls.

Uploaded by

Nishit
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

M. S.

Ramaiah Institute of Technology


(Autonomous Institute, Affiliated to VTU)
Department of Computer Science and Engineering

File system
Chandrika Prasad
Vandana S Sardar
Shilpa Hariraj
Chapter 10: File-System Interface
• File Concept
• Access Methods
• Directory Structure
• File-System Mounting
• File Sharing
• Protection
Objectives
• To explain the function of file systems
• To describe the interfaces to file systems
• To discuss file-system design tradeoffs,
including access methods, file sharing,
file locking, and directory structures
• To explore file-system protection
File Attributes
• 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
• Create
• Write
• Read
• Reposition within file
• Delete
• Truncate
• Open(Fi) – search the directory structure on disk for
entry Fi, and move the content of entry to memory
• Close (Fi) – move the content of entry Fi in memory
to directory structure on disk
Open Files
• Several pieces of data are needed to manage
open files:
– File pointer: pointer to last read/write location, per
process that has the file open
– File-open count: counter of number of times a file
is open – to allow removal of data from open-file
table when last processes closes it
– Disk location of the file: cache of data access
information
– Access rights: per-process access mode information
File Types – Name, Extension
Access Methods
• Sequential Access
read next
write next
reset
no read after last write
(rewrite)
• Direct Access
read n
write n
position to n
read next
write next
rewrite n
n = relative block number
Sequential-access File
Simulation of Sequential Access on a Direct-access File
Example of Index and Relative Files
A Typical File-system Organization

 Could use entire disk for FS, but


 system could have multiple FS types (e.g., swap)
 Disk divided into miniature disks called partitions or slices
Directory Structure
• A collection of nodes containing information about all files

Directory

Files
F1 F2 F4
F3
Fn

Both the directory structure and the files reside on disk


Operations Performed on Directory
• List directory contents
• Search for a file
• Create a file
• Delete a file
• Rename a file
• Traverse the file system
Organize the Directory (Logically) to Obtain

• 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, …)
Single-Level Directory
• A single directory for all users
– Called the root directory

 Pros: Simple, easy to quickly locate files


 Cons: inconvenient naming (uniqueness), no grouping
Two-Level Directory
• Separate directory for each user

 Introduces the notion of a path name


 Can have the same file name for different user
 Efficient searching
 No grouping capability
Tree-Structured Directories

 Directories can now contain files and subdirectories


 Efficient searching, allows grouping
Path Names
• To access a file, the user should either:
– Go to the directory where file resides, or
– Specify the path where the file is
• Path names are either absolute or relative
– Absolute: path of file from the root directory
– Relative: path from the current working directory
• Most OSes have two special entries in each
directory:
– “.” for current directory and “..” for parent
Acyclic-Graph Directories
• Allow sharing of subdirectories and files
Acyclic-Graph Directories (Cont.)
• Two different names (aliasing)
• If dict deletes list  dangling pointer
Solutions:
– Backpointers, so we can delete all pointers
Variable size records a problem
– Backpointers using a daisy chain organization
– Reference count for each file
• New directory entry type
– Link – another name (pointer) to an existing file
– Resolve the link – follow pointer to locate the file
General Graph Directory
General Graph Directory (Cont.)
• How do we guarantee no cycles?
– Allow only links to files not subdirectories
– Garbage collection
– Every time a new link is added use a cycle
detection algorithm to determine whether it
is OK
Protection
• File owner/creator should be able to control:
– what can be done
– by whom
• Types of access
– Read
– Write
– Execute
– Append
– Delete
– List
Categories of Users
• Individual user
– Log in establishes a user-id
– Might be just local on the computer or could be
through interaction with a network service
• Groups to which the user belongs
– For example, “nahum” is in “w4118”
– Again could just be automatic or could involve
talking to a service that might assign, say, a
temporary cryptographic key
UNIX Access Rights
• Mode of access: read, write, execute
• Three classes of users
RWX
a) owner access 7  1 1 1
RWX
b) group access 6  110
RWX
c) public access 1  001
• Ask manager to create a group (unique name), say G, and add
some users to the group.
• For a particular file (say game) or subdirectory, define an
appropriate access.

owner group public

Attach a group to a file: chgrp G game chmod 761 game


Issues with UNIX Access Rights
• Just a single owner, a single group and the
public
– Pro: Compact enough to fit in just a few bytes
– Con: Not very expressive
• Access Control List: This is a per-file list that
tells who can access that file
– Pro: Highly expressive
– Con: Harder to represent in a compact way
Windows XP Access-control List Management

You might also like