Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

CH 8file System

Uploaded by

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

CH 8file System

Uploaded by

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

1

File System
File-System Interface
2

• File Concept
• Access Methods
• Disk and Directory Structure
• File-System Mounting
• File Sharing
• Protection
Objectives
3

• 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 Concept
4

Contiguous logical address space


• Types:
• Data
• numeric
• character
• binary
• Program
Contents defined by file’s creator
• Many types
• Consider text file, source file, executable file
File Attributes
5

• 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
6

File is an abstract data type


• Create
• Write – at write pointer location
• Read – at read pointer location
• Reposition within file - seek
• Delete
• Truncate (removing the file contents without deleting the file)
• 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
7

Several pieces of data are needed to manage open files:


• Open-file table: tracks 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
Open File Locking
8

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
9
Directory Structure
12
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


Types of File Systems
13

• We mostly talk of general-purpose file systems


• But systems frequently have may file systems,
some general- and some special- purpose
• Consider Solaris or other Operating system’s file systems from
other references
Operations Performed on
14 Directory
• Search for a file
• Create a file
• Delete a file
• List a directory
• Rename a file
• Traverse the file system
Directory Organization
15

The directory is organized 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, …)
File Sharing
16

• Sharing of files on multi-user systems is desirable


• 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
• If multi-user system
• User IDs identify users, allowing permissions and protections to be
per-user
• Group IDs allow users to be in groups, permitting group access
rights
• Owner of a file / directory
• Group of a file / directory
File Sharing – Remote File Systems
17
• 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
18

• 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
• Stateless protocols such as NFS v3 include all information
in each request, allowing easy recovery but less security
Protection
20

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
21
Mode of access: read, write, execute
Three classes of users on Unix / Linux
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.

Attach a group to a file


chgrp G game
Windows Access-Control List
22
Mgmt
A Sample UNIX Directory Listing
23

Associated with each file and directory are three fields


• owner,
• group, &
• universe
Each consisting of the three bits
rwx, where
 r controls read access,
 w controls write access, &
 x controls execution.
File System Layers
24

• Device drivers manage I/O devices at the I/O control layer


• Given commands like “read drive1, cylinder 72, track 2, sector 10, into
memory location 1060” outputs low-level hardware specific commands
to hardware controller
• Basic file system given command like “retrieve block 123” translates to
device driver
• Also manages memory buffers & caches (allocation, freeing, replacement)
• Buffers hold data in transit
• Caches hold frequently used data
• File organization module understands files, logical address, and physical
blocks
 Translates logical block # to physical block #
 Manages free space, disk allocation
File System Layers (Cont.)
25

• Logical file system manages metadata information


• Translates file name into file number, file handle, location by
maintaining file control blocks (inodes in UNIX)
• Directory management
• Protection
• Layering useful for reducing complexity and redundancy, but
adds overhead and can decrease performance
• Logical layers can be implemented by any coding method
according to OS designer
File-System Implementation
26

• We have system calls at the API level, but how do we implement


their functions?
• On-disk and in-memory structures
• Boot control block contains info needed by system to boot OS
from that volume
• Needed if volume contains OS, usually first block of volume
• Volume control block (superblock, master file table) contains
volume details
• Total # of blocks, # of free blocks, block size, free block
pointers or array
In-Memory File System
27 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
In-Memory File System
28
Structures

You might also like