DFS Design and Implementation: Brent R. Hafner
DFS Design and Implementation: Brent R. Hafner
2
DFS Design and Implementation
Brent R. Hafner
1
File Concept
2
Logical components of a file
3
File Attributes
4
Access Methods
• Sequential access: information is processed in order
– read next
– write next (append to the end of the file)
– reset to the beginning of file
– skip forward or backward n records
• Direct access: a file is made up of fixed length logical blocks
or records
– read n
– write n
– position to n
– read next
– write next
– rewrite n
5
Access Methods (Cont.)
6
Major Components in A File
System
A file system organizes and provides access and
protection services for a collection of files
7
Directory Structure
• Access to a file must first use a
directory service to locate the Directory
file.
• A collection of nodes containing
information about all files.
• Both the directory structure and
the files reside on disk.
F1 F2 F4
F3
Fn
Files
8
Information in a Directory
• Name
• Type: file, directory, symbolic link, special file…
• Address: device blocks to store a file
• Current length
• Maximum length
• Date last accessed (for archival)
• Date last updated (for dump)
• Owner ID
• Protection information
9
Operations Performed on
Directory
• Search for a file
• Create a file
• Delete a file
• List a directory Some kind of name service
• Rename a file
• Traverse the file system
10
Tree-Structured Directories –
Hierarchical Structure of A File System
Subdirectory is just a
11 special type of file…
Authorization Service
12
File Service – File Operations
• Create • Delete
– Allocate space – Search the directory
– Make an entry in the directory – Release all file space
• Write • Truncate
– Search the directory
– Reset the file to length zero
– Write is to take place at the
location of the write pointer • Open(Fi)
• Read – Search the directory structure
– Search the directory – Move the content of the directory
– Read is to take place at the entry to memory
location of the read pointer • Close(Fi)
• Reposition within file – file seek – move the content in memory to
– Set the current file pointer to a directory structure on disk
given value
• Get/set file attributes
13
System Service
14
DFS Architecture –
NFS Example
15
File Mounting
• A useful concept for constructing a large file system from
various file servers and storage devices
• Attach a remote named file system to the client’s file system
hierarchy at the position pointed to by a path name
(mounting point)
– A mounting point is usually a leaf of the directory tree that contains
only an empty subdirectory
– mount claven.lib.nctu.edu.tw:/OS /chow/book
• Once files are mounted, they are accessed by using the
concatenated logical path names without referencing either
the remote hosts or local devices
– Location transparency
– The linked information (mount table) is kept until they are unmounted
16
File Mounting Example
root root
chow Export OS
Mount
paper book DFS DSM
/OS/DSM
17
File Mounting (Cont.)
• Different clients may perceive a different FS view
– To achieve a global FS view – SA enforces mounting rules
• Export: a file server restricts/allows the mounting of all or
parts of its file system to a predefined set of hosts
– The information is kept in the server’s export file
• File system mounting:
– Explicit mounting: clients make explicit mounting system calls
whenever one is desired
– Boot mounting: a set of file servers is prescribed and all mountings
are performed the client’s boot time
– Auto-mounting: mounting of the servers is implicitly done on demand
when a file is first opened by a client
18
Location Transparency
No global naming
19
A Simple Automounter for
NFS
20
Server Registration
21
Stateful and Stateless File
Servers
• Stateless file server – when a client sends a request to a server, the
server carries out the request, sends the reply, and then remove from its
internal tables all information about the request
– Between requests, no client-specific information is kept on the server
– Each request must be self-contained: full file name and offset…
• Stateful file server – file servers maintain state information about clients
between requests
• State information – may be kept in servers or clients
– Opened files and their clients
– File descriptors and file handles
– Current file position pointers
– Mounting information Session: a connection for a sequence
– Lock status of requests and responses between a
– Session keys client and the file server
– Cache or buffer
22
A Comparison between
Stateless and Stateful Servers
23
Issues of A Stateless File
Server
• Idempotency requirement
– Is it practical to structure all file accesses as idempotent operations?
• File locking mechanism
– Should locking mechanism be integrated into the transaction service?
• Session key management
– Can one-time session key be used for each file access?
• Cache consistency
– Is the file server responsible for controlling cache consistency among
clients?
– What sharing semantics are to be supported?
24
File Sharing
• Overlapping access: multiple copies of the same file
– Space multiplexing of the file
– Cache or replication
– Coherency control: managing accesses to the replicas, to provide a
coherent view of the shared file
– Desirable to guarantee the atomicity of updates (to all copies)
• Interleaving access: multiple granularities of data access
operations
– Time multiplexing of the file
– Simple read/write, Transaction, Session
– Concurrency control: how to prevent one execution sequence from
interfering with the others when they are interleaved and how to
avoid inconsistent or erroneous results
25
Space Multiplexing
26
Remote Access VS
Download/Upload Access
27
Four Places to Caching
Client Server
28
Coherency of Replicated
Data
• Four interpretations:
– All replicas are identical at all times
• Impossible in distributed systems
– Replicas are perceived as identical only at some points in time
• How to determine the good synchronization points?
– Users always read the “most recent” data in the replicas
• How to define “most recent”?
– Based on the “completion” times of write operations (the
effect of a write operation has been reflected in all copies)
– Write operations are always performed “immediately” and their
results are propagated in a best-effort fasion
• Coarse attempt to approximate the third definition
29
Time Multiplexing
30
Space and Time
Concurrencies of File Access
Space Remote Access Cache Access Download/Upload
Time Access
31
Semantics of File Sharing
a) On a single processor, when a read follows a
write, the value returned by the read is the
value just written (Unix Semantics).
b) In a distributed system with caching, obsolete
values may be returned.
32
Semantics of File Sharing
(Cont.)
33
Version Control
34
Version Control (Cont.)
35
Windows 2003 Server R2
39
References
40