Unit - Iii: Prepared by N.Susila Ap/It Skcet
Unit - Iii: Prepared by N.Susila Ap/It Skcet
Prepared By
N.Susila
AP/IT
SKCET
1
DISTRIBUTED FILE SYSTEM
Introduction
File Service Architecture
DFS: Case Studies
Case Study: Sun NFS
Case Study: The Andrew File System
DISTRIBUTED FILE SYSTEM
3
DISTRIBUTED FILE SYSTEM
4
DISTRIBUTED FILE SYSTEM
5
DISTRIBUTED FILE SYSTEM
6
DISTRIBUTED FILE SYSTEM
7
DISTRIBUTED FILE SYSTEM
8
DISTRIBUTED FILE SYSTEM
File length
Creation timestamp
Read timestamp
Write timestamp
Attribute timestamp
Reference count
Owner
File type
Access control list
9
DISTRIBUTED FILE SYSTEM
10
DISTRIBUTED FILE SYSTEM
filedes = open(name, mode) Opens an existing file with the given name.
filedes = creat(name, mode) Creates a new file with the given name.
Both operations deliver a file descriptor referencing the open
file. The mode is read, write or both.
status = close(filedes) Closes the open file filedes.
count = read(filedes, buffer, n) Transfers n bytes from the file referenced by filedes to buffer.
count = write(filedes, buffer, n) Transfers n bytes to the file referenced by filedes from buffer.
Both operations deliver the number of bytes actually transferred
and advance the read-write pointer.
pos = lseek(filedes, offset, Moves the read-write pointer to offset (relative or absolute,
whence) depending on whence).
status = unlink(name) Removes the file name from the directory structure. If the file
has no other names, it is deleted.
status = link(name1, name2) Adds a new name (name2) for a file (name1).
status = stat(name, buffer) Gets the file attributes for file name into buffer.
11
DISTRIBUTED FILE SYSTEM
12
DISTRIBUTED FILE SYSTEM
13
DISTRIBUTED FILE SYSTEM
Client module
14
DISTRIBUTED FILE SYSTEM
15
DISTRIBUTED FILE SYSTEM
Directory service:
Provides mapping between text names for the files
and their UFIDs. Clients may obtain the UFID of a
file by quoting its text name to directory service.
Directory service supports functions needed
generate directories, to add new files to directories.
16
DISTRIBUTED FILE SYSTEM
Client module:
It runs on each computer and provides integrated
service (flat file and directory) as a single API to
application programs. For example, in UNIX hosts, a
client module emulates the full set of Unix file
operations.
It holds information about the network locations of
flat-file and directory server processes; and achieve
better performance through implementation of a
cache of recently used file blocks at the client.
17
DISTRIBUTED FILE SYSTEM
18
DISTRIBUTED FILE SYSTEM
Access control
In distributed implementations, access rights checks
have to be performed at the server because the
server RPC interface is an otherwise unprotected
point of access to files.
Directory service interface
contains a definition of the RPC interface to a
directory service.
Lookup(Dir, Name) -> FileId Locates the text name in the directory and
20
DISTRIBUTED FILE SYSTEM
-throws NameDuplicate to the directory and updates the file’s attribute record.
If Name is already in the directory: throws an exception.
UnName(Dir, Name) If Name is in the directory, the entry containing Name
is removed from the directory.
If Name is not in the directory: throws an exception.
GetNames(Dir, Pattern) -> NameSeq Returns all the text names in the directory that match the
regular expression Pattern.
21
DISTRIBUTED FILE SYSTEM
22
DISTRIBUTED FILE SYSTEM
IP address date
23
DISTRIBUTED FILE SYSTEM
24
DISTRIBUTED FILE SYSTEM
Application Application
program program
UNIX
system calls
UNIX kernel
UNIX kernel Virtual file system Virtual file system
Operations Operations
on local files on
file system
remote files
UNIX NFS NFS UNIX
file file
Other
client server
system system
NFS protocol
NFS architecture (remote operations)
*
25
DISTRIBUTED FILE SYSTEM
fh = file handle:
26
DISTRIBUTED FILE SYSTEM
27
DISTRIBUTED FILE SYSTEM
28
DISTRIBUTED FILE SYSTEM
Mount service
Mount operation:
mount(remotehost, remotedirectory, localdirectory)
Server maintains a table of clients who have
mounted filesystems at that server.
Each client maintains a table of mounted file
systems holding:
< IP address, port number, file handle>
Remote file systems may be hard-mounted or
soft-mounted in a client computer.
Figure 10 illustrates a Client with two remotely
mounted file stores.
30
DISTRIBUTED FILE SYSTEM
Remote Remote
people students x staff users
mount mount
31
DISTRIBUTED FILE SYSTEM
Automounter
The automounter was added to the UNIX
implementation of NFS in order to mount a remote
directory dynamically whenever an ‘empty’ mount
point is referenced by a client.
Automounter has a table of mount points with a
reference to one or more NFS servers listed against
each.
it sends a probe message to each candidate server
and then uses the mount service to mount the
filesystem at the first server to respond.
Automounter keeps the mount table small.
32
DISTRIBUTED FILE SYSTEM
33
DISTRIBUTED FILE SYSTEM
Server caching
Similar to UNIX file caching for local files:
pages (blocks) from disk are held in a main memory
buffer cache until the space is required for newer
pages. Read-ahead and delayed-write optimizations.
For local files, writes are deferred to next sync event
(30 second intervals).
Works well in local context, where files are always
accessed through the local cache, but in the remote
case it doesn't offer necessary synchronization
guarantees to clients.
34
DISTRIBUTED FILE SYSTEM
Client caching
Server caching does nothing to reduce
RPC traffic between client and server
further optimization is essential to reduce
server load in large networks.
NFS client module caches the results of
read, write, getattr, lookup and readdir
operations
synchronization of file contents (one-copy
semantics) is not guaranteed when two or
more clients are sharing the same file.
36
DISTRIBUTED FILE SYSTEM
t freshness guarantee
Tc time when cache entry was last
validated
Tm time when block was last
updated at server
T current time
37
DISTRIBUTED FILE SYSTEM
38
DISTRIBUTED FILE SYSTEM
39
DISTRIBUTED FILE SYSTEM
NFS performance
Early measurements (1987) established that:
Write() operations are responsible for only 5% of
server calls in typical UNIX environments.
– hence write-through at server is acceptable.
Lookup() accounts for 50% of operations -due to
step-by-step pathname resolution necessitated by
the naming and mounting semantics.
More recent measurements (1993) show high
performance.
see www.spec.org for more recent measurements.
40
DISTRIBUTED FILE SYSTEM
NFS summary
NFS is an excellent example of a simple,
robust, high-performance distributed
service.
Achievement of transparencies are other
goals of NFS:
Access transparency:
– The API is the UNIX system call interface for
both local and remote files.
41
DISTRIBUTED FILE SYSTEM
Location transparency:
– Naming of filesystems is controlled by client
mount operations, but transparency can be
ensured by an appropriate system configuration.
Mobility transparency:
– Hardly achieved; relocation of files is not
possible, relocation of filesystems is possible,
but requires updates to client configurations.
Scalability transparency:
– File systems (file groups) may be subdivided
and allocated to separate servers.
Ultimately, the performance limit is determined
by the load on the server holding the most
heavily-used filesystem (file group).
42
DISTRIBUTED FILE SYSTEM
Replication transparency:
– Limited to read-only file systems; for writable
files, the SUN Network Information Service
(NIS) runs over NFS and is used to replicate
essential system files.
Hardware and software operating system
heterogeneity:
– NFS has been implemented for almost every
known operating system and hardware platform
and is supported by a variety of filling systems.
Fault tolerance:
– Limited but effective; service is suspended if a
server fails. Recovery from failures is aided by
the simple stateless design.
43
DISTRIBUTED FILE SYSTEM
Consistency:
– It provides a close approximation to one-copy
semantics and meets the needs of the vast
majority of applications.
– But the use of file sharing via NFS for
communication or close coordination between
processes on different computers cannot be
recommended.
Security:
– Recent developments include the option to use
a secure RPC implementation for authentication
and the privacy and security of the data
transmitted with read and write operations.
44
DISTRIBUTED FILE SYSTEM
Efficiency:
–NFS protocols can be implemented for use in
situations that generate very heavy loads.
45
DISTRIBUTED FILE SYSTEM
46
DISTRIBUTED FILE SYSTEM
Workstations Servers
User Venus
program
Vice
UNIX kernel
UNIX kernel
Vice
Venus
User
program UNIX kernel
UNIX kernel
47
DISTRIBUTED FILE SYSTEM
48
DISTRIBUTED FILE SYSTEM
Local Shared
/ (root)
bin
Symbolic
links
49
DISTRIBUTED FILE SYSTEM
50
DISTRIBUTED FILE SYSTEM
Workstation
User Venus
program
UNIX file Non-local file
system calls operations
UNIX kernel
UNIX file system
Local
disk
51
DISTRIBUTED FILE SYSTEM
52
DISTRIBUTED FILE SYSTEM
Fetch(fid) -> attr, data Returns the attributes (status) and, optionally, the contents of file
identified by the fid and records a callback promise on it.
Store(fid, attr, data) Updates the attributes and (optionally) the contents of a specified
file.
Create() -> fid Creates a new file and records a callback promise on it.
Remove(fid) Deletes the specified file.
SetLock(fid, mode) Sets a lock on the specified file or directory. The mode of the
lock may be shared or exclusive. Locks that are not removed
expire after 30 minutes.
ReleaseLock(fid) Unlocks the specified file or directory.
RemoveCallback(fid) Informs server that a Venus process has flushed a file from its
cache.
BreakCallback(fid) This call is made by a Vice server to a Venus process. It cancels
the callback promise on the relevant file.
53
DISTRIBUTED FILE SYSTEM
URL
http://www.cdk3.net:8888/WebExamples/earth.html
DNS lookup
Resource ID (IP number, port number, pathname)
Web server
Network address
2:60:8c:2:b0:5a file
Socket
DISTRIBUTED FILE SYSTEM
NS2
2
Name
1 NS1 servers
Client
3
NS3
NS2 NS2
2 2
4 3
1 1
NS1 NS1
client client
4 3 5
NS3 NS3
Non-recursive Recursive
server-controlled server-controlled
A name server NS1 communicates with other name servers on behalf of a client
DISTRIBUTED FILE SYSTEM
ic.ac.uk
qmw.ac.uk
dcs.qmw.ac.uk *.dcs.qmw.ac.uk
*.ic.ac.uk
*.qmw.ac.uk
admin
Printing
Client 1. ‘finance’ service
lookup service?
admin
Lookup Client
service
Network 2. Here I am: .....
4. Use printing
service admin, finance
3. Request Lookup
Corporate Printing printing service
infoservice service
finance
DISTRIBUTED FILE SYSTEM
DI: 599(EC)
DI: 437 AC
Peter.Smith
mailboxes password
UK FR US CANADA
DI: 543 DI: 574 DI: 732 DI: 457
DISTRIBUTED FILE SYSTEM
DI: 633(WORLD)
Well-known directories:
#599 = #633/EC
#642 = #633/NORTH AMERICA EC NORTH AMERICA
US US CANADA
DI: 543 UK FR DI: 574 DI: 732 DI: 457
#633/EC/US
DISTRIBUTED FILE SYSTEM
DUA DSA
DSA
DSA
DUA
DSA
DISTRIBUTED FILE SYSTEM
... Alice Flintstone (person)... Pat King (person)James Healey (person) Janet Papworth (person) ...
DISTRIBUTED FILE SYSTEM
info
Alice Flintstone, Departmental Staff, Department of Computer Science,
University of Gormenghast, GB
commonName uid
Alice.L.Flintstone alf
Alice.Flintstone
Alice Flintstone mail
A. Flintstone
[email protected]
surname [email protected]
Flintstone roomNumber
telephoneNumber Z42
+44 986 33 4604 userClass
Research Fellow
DISTRIBUTED FILE SYSTEM
66