Chapter 17: Distributed-File Systems Part 2Chapter 17 Distributed-File SystemsChapter ObjectivesStateful File ServiceStateful File Service - 2Stateless File ServerStateless File Server - 2Distinctions Between Stateful & Stateless Service (1 of 3)Distinctions (2 of 3)Distinctions (3 of 3)File ReplicationFile Replicas – the big issueAndrew File SystemAn Example: AFSANDREW (Cont.)Slide 16ANDREW Shared Name SpaceANDREW File OperationsANDREW ImplementationANDREW Implementation (Cont.)End of Chapter 17.2Chapter 17: Distributed-File SystemsChapter 17: Distributed-File SystemsPart 2Part 217.2Silberschatz, Galvin and Gagne ©2005Operating System ConceptsChapter 17 Distributed-File SystemsChapter 17 Distributed-File SystemsChapter 17.1BackgroundNaming and TransparencyRemote File Access Chapter 17.2Stateful versus Stateless ServiceFile ReplicationAn Example: AFS17.3Silberschatz, Galvin and Gagne ©2005Operating System ConceptsChapter ObjectivesChapter ObjectivesTo contrast stateful and stateless distributed file serversTo show how replication of files on different machines in a distributed file system is a useful redundancy for improving availability17.4Silberschatz, Galvin and Gagne ©2005Operating System ConceptsStateful File ServiceStateful File ServiceStateful File Service: Server either tracks each file being accessed by a each client or else it is stateless. Stateful File Service:Client opens a fileServer fetches information about the file from its disk, stores it in its memory, and gives the client a connection identifier unique to the client and the open file –Identifier is used for subsequent accesses until session endsA stateful service is characterized by a connection between the client and the server during a ‘session.’ Server keeps main memory information about all of its clients.Server reclaims main-memory space used by clients when no longer active.17.5Silberschatz, Galvin and Gagne ©2005Operating System ConceptsStateful File Service - 2Stateful File Service - 2Advantages: We certainly getIncreased performanceFewer disk accesses because file information is cached in main memory in the server and can be readily accessed by the connection identifier (In Unix, the server fetches an inode and provides the client a file descriptor which serves as an index to an in-core table of inodes)Stateful server knows if a file was opened for sequential access and can thus read ahead the next blocks17.6Silberschatz, Galvin and Gagne ©2005Operating System ConceptsStateStatelessless File Server File ServerStateless: This mechanism only provides blocks of data as / when requested with no knowledge of how the client uses or modifies the data.Here, each request is self-contained; by itself.Thus no state information is maintained by the server.Each request must thus tell the server the exact file and position in the file it wishes transmitted to the client.Server does not keep track of open files – although it may do so for its own internal efficiency considerations.Establishing or closing a connection is not necessary, as each action is separate and there is no notion of a ‘session.’17.7Silberschatz, Galvin and Gagne ©2005Operating System ConceptsStateStatelessless File Server - 2 File Server - 2Operationally, a client opens a file. Then reads and writes take place as remote messages.The final ‘close’ message is simply a local operation.Stateless servers have no knowledge of the purpose of a client’s requests.The older version of NFS by SUN use this mechanism.17.8Silberschatz, Galvin and Gagne ©2005Operating System ConceptsDistinctions Between Stateful & Stateless Service Distinctions Between Stateful & Stateless Service (1 of 3)(1 of 3)Failure Recovery, a.k.a. ‘crashes’ with a Stateful Server:A stateful server loses all its volatile state in a crashIn most cases, operations underway will be aborted.State can be restored by a recovery protocol based on a dialog with clientsThis can take some time…Server needs to be aware of client failures in order to reclaim space allocated to record the state of crashed client processes Failure Recover with a Stateless Server is simpler.With stateless server, the effects of server failure and recovery are almost unnoticeableA newly reincarnated server can respond to a self-contained request without any difficultyBut, of course, there are its downsides too. 17.9Silberschatz, Galvin and Gagne ©2005Operating System ConceptsDistinctions (2 of 3)Distinctions (2 of 3)Downsides for Stateless Servers – real downsides:There’s no in-core information about a session going on, So we get longer request messages, lower request processing, andadditional constraints imposed on DFS design–Since each request targets a file, some kind of uniform, system-wide, low-level naming scheme must be used.–Translating these to local names for each request takes time.–Requests for services (transmitting a file) as well as file deletes must be idempotent.»The same thing must happen if repeated.»Be careful regarding deletes!–“Not difficult to implement if reads and writes use an absolute byte count to indicate exact position within a file they are trying to access and do not rely on an offset (like Unix read() and write() system calls in Unix).”17.10Silberschatz, Galvin and Gagne ©2005Operating System ConceptsDistinctions (3 of 3)Distinctions (3 of 3)Some platforms actually require stateful serviceConsider:A server that undertakes server-initiated cache validation can not provide stateless service, because it maintains a record of which files are cached by which clients.We saw the advantages of stateful service earlier.Example of Stateful service:Unix is stateful: UNIX uses file descriptors and implicit offsets.Such servers must maintain tables to map the file descriptors to inodes, and store the current offset within a fileExample of Stateless service:Sun’s NFS is stateless. It does not use file descriptors but does include an explicit offset for every access.17.11Silberschatz, Galvin and Gagne ©2005Operating System ConceptsFile ReplicationFile ReplicationReplicas: We often have replicas of files on different machines. Provides for redundancy and increased availability.Big Issue: consistency. Better
View Full Document