Chapter 11 Outline. File concept Accessing file data Directory structure Protection of information on disk

Chapter 11 – Outline  File concept  Accessing file data  Directory structure  Protection of information on disk 1 File System Abstraction Phys...
Author: Jayson Cannon
3 downloads 0 Views 670KB Size
Chapter 11 – Outline  File concept

 Accessing file data  Directory structure  Protection of information on disk

1

File System Abstraction Physical reality

File system abstraction

Block-oriented

Byte-oriented

Physical sectors

Named files

No protection

Users protected from one another Robust to machine failures

Data might be corrupted if machine crashes

2

Characteristics of a File  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 3

File System Organization  Disk can be subdivided into

partitions 

raw partition – without a file system



formatted partition – with a file system

 Partition containing file

system known as a volume  Computer systems may have multiple types of file systems 

general-purpose, virtual, network

4

Directories  Structure to hold information about the files in a system 

partition containing a file system is called a volume



records name, location, size, type, etc. of all files in a volume

 Directory operations 

search file, create file, delete file, rename file, list directory, traverse the file system

 Logical organization of a directory for 

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, …)

 Study several different directory structures 5

Single-Level Directory  A single directory for all users

 Advantages 

simple structure, easy and efficient to support

 Disadvantages 

name collisions, multiple users/files may have the same name



not scalable for large systems



cannot group related files together 6

Two-Level Directory  Separate directory for each user 

OS only searches user directory for files

 Disadvantages 

still not very scalable, user cannot name two files the same



users may not be allowed to share or group files



system files and libraries need to be shared

7

Tree-Structured Directories  Generalization of two-level structure 

one root directory



unique path for every file in the directory structure

8

Tree-Structured Directories (2)  Advantages 

conceptual model maps well into human model of organizing things



scalable -- the probability of name collisions decreases



spatial locality – store all files under a directory within a cylinder to avoid disk seeks



simple searching (based on absolute or relative paths)



grouping capability

 Disadvantages 



not all files fit into the hierarchical model 

some files may need to be listed under multiple directories



shared files

accessing a file may involve many levels of directory lookups 

inefficient 9

Acyclic-Graph Directories  Allows sharing of files or subdirectories 

same file appears under multiple directory listings

10

Acyclic-Graph Directories (2)  Links to implement file sharing 

pointer to another file or subdirectory



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



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

 Problem of aliasing 

shared structures may be traversed more than once



do not follow links during directory traversal

 If user deletes the shared file 

symbolic links become dangling pointers



search for all links and remove them?



leave the links, but fail to resolve when used



what is file is deleted, and later file with same name is created before link is used ? 11

Reliability and Protection  Reliability – file system must be safe from physical

damage 

provide duplication using backups on tertiary storage



RAID systems

 Protection – prevent file system from improper access 

file creator/owner decides who may access the files, and



how files may be accessed by each user or group

12

Protection  Types of access 

read, write, execute, append, delete, list



provide low-level protection with read, write and execute privilege



higher-level functions for append, list, delete, rename, copy implemented with low-level checks

 Access control 

assign different access types to every file, directory for each user



Access control lists (ACL)





associate user name, type of access with every file entry



inefficient, variable and large sized directory entry, tedious to create ACL for each file

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 13

Access Lists and Groups  

 

Mode of access: read, write, execute Three classes of users RWX a) owner access 7  RWX b) group access 6  RWX c) public access 1 

111 110

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 chmod

Attach a group to a file: chgrp

group 761

G

public game

game

14

Windows XP Access-control List Management

15

Permissions in a Unix System

16