



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




1
^
File concept
Accessing file data
Directory structure
Protection of information on disk
^
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^ l
text, binary, application-defines structures, etc.
Files have several attributes^ l
name, identifier, type, location, size, protection and accountinginformation
File operations^ l
basic operations: create, read, write, seek, delete, truncate l other operations: copy, rename, list file attributes
Operating system structures^ l
system-wide open-file table l process-specific open-file table
^
Can indicate the internal structure of a file^ l
file extensions can be used to indicate file type
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
Unix attempts no interpretation of files^ l
application provides code to interpret file structures
Magic number at start of file may recognize file structure^ l
inserted by the application creating the file
5
^
^
Sequential access^ l
bytes are accessed in order l operations:
read_next
,^ write_next, rewind, skip
n records
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
of length
^
request for
L^
bytes starting at location
L * N
from file start
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
^
Sequential access
Indexed access
^
Disk can be subdivided into partitions^ l
raw
partition – without a file system l^
formatted
partition – with a file
system
Partition containing filesystem known as a
volume
Computer systems mayhave multiple types of filesystems^ l
general-purpose, virtual,network
13
^
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
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
^
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
^
Allows sharing of files or subdirectories^ l
same
file appears under multiple directory listings
17
^
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
Problem of aliasing^ l
shared structures may be traversed more than once l do not follow links during directory traversal
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?
^
Reliability – file system must be safe from physicaldamage^ l
provide duplication using backups on tertiary storage l RAID systems
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
^
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
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
!^