Docsity

File System Structures and Access Modes - Prof. Prasad Kulkarni, Study notes of Operating Systems

Toggle sidebar
bg1
1


■File concept
■Accessing file data
■Directory structure
■Protection of information on disk
2


 
 
 
  




3


■Provides a mode of permanent storage of information.
■Information in a file is related in some way.
■Files can hold any kind of information
●text, binary, application-defines structures, etc.
■Files have several attributes
●name, identifier, type, location, size, protection and accounting
information
■File operations
●basic operations: create, read, write, seek, delete, truncate
●other operations: copy, rename, list file attributes
■Operating system structures
●system-wide open-file table
●process-specific open-file table
4


■Can indicate the internal structure of a file
●file extensions can be used to indicate file type
■Should OS recognize specific file structures ?
●should at least recognize structure of an executable file
●may require OS to handle all such structures, increasing size
●may disallow custom user-defined file structures
■Unix attempts no interpretation of files
●application provides code to interpret file structures
■Magic number at start of file may recognize file structure
●inserted by the application creating the file
pf3
pf4
pf5

Partial preview of the text

Download File System Structures and Access Modes - Prof. Prasad Kulkarni and more Study notes Operating Systems in PDF only on Docsity!

1



 

^

      

n^

File concept

n^

Accessing file data

n^

Directory structure

n^

Protection of information on disk



 

^

      

^

^

^

3



 

^

      

n^

Provides a mode of permanent storage of information.

n^

Information in a file is related in some way.

n^

Files can hold any kind of information^ l

text, binary, application-defines structures, etc.

n^

Files have several attributes^ l

name, identifier, type, location, size, protection and accountinginformation

n^

File operations^ l

basic operations: create, read, write, seek, delete, truncate l other operations: copy, rename, list file attributes

n^

Operating system structures^ l

system-wide open-file table l process-specific open-file table



 

^

      

n^

Can indicate the internal structure of a file^ l

file extensions can be used to indicate file type

n^

Should OS recognize specific file structures?^ l

should at least recognize structure of an executable file l may require OS to handle all such structures, increasing size l may disallow custom user-defined file structures

n^

Unix attempts no interpretation of files^ l

application provides code to interpret file structures

n^

Magic number at start of file may recognize file structure^ l

inserted by the application creating the file

5



 

^

      



 

^

      

n^

Sequential access^ l

bytes are accessed in order l operations:

read_next

,^ write_next, rewind, skip

n records

n^

Random (direct) access^ l^

bytes are accessed in any order l^

each access uses a relative address from the start of the file l^

request for record

N

of length

L

^

request for

L^

bytes starting at location

L * N

from file start

n^

Index-based access^ l

construct an index for the file l user specifies index of the record to retrieve l search for index in the index-file, which points to the record on disk

7



 

^

      

n^

Sequential access

n^

Indexed access



 

^

      

^

n^

Disk can be subdivided into partitions^ l

raw

partition – without a file system l^

formatted

partition – with a file

system

n^

Partition containing filesystem known as a

volume

n^

Computer systems mayhave multiple types of filesystems^ l

general-purpose, virtual,network

13



 

^

      

n^

Advantages^ l

conceptual model maps well into human model of organizing things l scalable -- t

^

l^

spatial locality – store all files under a directory within a cylinder toavoid disk seeks l^

simple searching (based on

absolute

or

relative

paths)

l^

grouping capability

n^

Disadvantages^ l

not all files fit into the hierarchical model^ 

some files may need to be listed under multiple directories  shared files l^

accessing a file may involve many levels of directory lookups^ 

inefficient



 

^

      

Read the file header for the root directory^ l

stored at a fixed location on disk

Read the first data block for the root directory, lookupdirectory entry for pets

Read the file header for pets

Read data block for pet directory, lookup entry for cat.jpg

Read the header file for cat.jpg

Read the data block for cat.jpg

  

^

 



15



 

^

      

n^

Performance optimizations^ l

cache top level directories in memory l a user inside a directory (e.g., /pets) can use relative path names(e.g., cat.jpg) to refer to files within the current directory



 

^

      

n^

Allows sharing of files or subdirectories^ l

same

file appears under multiple directory listings

17



 

^

      

n^

Links

to implement file sharing l^

pointer to another file or subdirectory l^

directory entry of link points includes the name of the real file l^

OS resolves link using the embedded path name to find the real file

n^

Problem of aliasing^ l

shared structures may be traversed more than once l do not follow links during directory traversal

n^

If user deletes the shared file^ l

symbolic links become dangling pointers l search for all links and remove them? l leave the links, but fail to resolve when used l what is file is deleted, and later file with same name is createdbefore link is used?



 

^

      

n^

Reliability – file system must be safe from physicaldamage^ l

provide duplication using backups on tertiary storage l RAID systems

n^

Protection – prevent file system from improper access^ l

file creator/owner decides who may access the files, and l how files may be accessed by each user or group

19



 

^

      

n^

Types of access^ l

read, write, execute, append, delete, list l provide low-level protection with read, write and execute privilege l higher-level functions for append, list, delete, rename, copyimplemented with low-level checks

n^

Access control^ l

assign different access types to every file, directory for each user l Access control lists (ACL)^ 

associate user name, type of access with every file entry  inefficient, variable and large sized directory entry, tedious to createACL for each file l^

Unix provides

owner, group, and universe

level permissions

^

combine access control list with owner,user,group form of permissions ^

ACLs checked before owner,user,group permissions



 

^

      

n^

Mode of access: read, write, execute n^

Three classes of users

RWX

a)^

owner access

7

⇒^

1 1 1RWX

b)^

group access

6

⇒^

1 1 0RWX

c)^ public access

1

⇒^

0 0 1

n^

Ask manager to create a group (unique name), say G, and add some users to the group. n^

For a particular file (say

game

) or subdirectory, define an appropriate access. owner

group

public

chmod

761

game

       

 

!^