Docsity

Consistency vs. Performance: Op Locks, DFS, and File Access in Distributed Systems - Prof., Study notes of Operating Systems

Partial preview of the text

Download Consistency vs. Performance: Op Locks, DFS, and File Access in Distributed Systems - Prof. and more Study notes Operating Systems in PDF only on Docsity!

CS 167 (^) XXVII–1 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Distributed File Systems (Part 3)

CS 167 (^) XXVII–2 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Consistency vs. Performance

  • Strict consistency is easy …
    • … if all operations take place on server
    • no client caching
  • Performance is good …
    • … if all operations take place on client
    • everything is cached on client
  • Put the two together …

ø

  • or you can do opportunistic locking

CS 167 (^) XXVII–4 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Refinements

  • Two types of op locks
    • level I
      • client may modify file
    • level II
      • client may not modify file
  • Client must request op lock
    • may request only level-I
  • Server may deny request
    • may give level-II instead
  • Requests done only on open

CS 167 (^) XXVII–5 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Read-Only Access

  • Why request a level-I op lock if file is to be

open read-only?

  • typical Windows application always opens

read-write

  • may never get around to writing …

CS 167 (^) XXVII–7 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Name Space: NFS

  • Basic NFS
    • local name spaces; assembled by clients
  • Achieve global name space by having each

client mount everything consistently

  • giving each client a table listing all possible

mounts is administratively difficult

  • performing all possible mounts is time

consuming

CS 167 (^) XXVII–8 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Rather than this …

dev etc home

atm dlev twd joel dap acath seliopou avd spr

CS 167 (^) XXVII–10 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DCE’s DFS

fs

system users projects

sol7 osf

bin bin usr

bin

twd motif dce

Client

Client

Client

Client

Client

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

DFS (DCE’s distributed file system) provides a cell-wide file system (a cell is a potentially large collection of machines under the same administration), organized into a cell-wide directory hierarchy. This hierarchy is logically partitioned into pieces called filesets. These filesets are stored on the DFS servers, using the server’s local file systems (e.g. UFS or Episode). This mapping of fileset to server is stored in a distributed database known as the fileset location database (FLDB). Clients contact the FLDB to determine the locations of filesets. To minimize network use, server load, and average client access time, the clients buffer portions of files on the clients’ local disks.

CS 167 (^) XXVII–11 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DFS Mount Points

fs

system users projects

sol7 osf

bin bin usr

bin

twd motif dce

Client

Client

Client

Client

Client

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

bin.sol7 bin.osf1 users.twd proj.motif proj.dce

root.cell

bin.sol bin.osf1 (^) users.twd proj.motif proj.dce

Filesets are named in a space that is independent of the directory hierarchy. This fileset name space is mapped via a distributed database called the fileset location database into the servers that manage them. DFS mount points are implemented as symbolic links, where the value of the link is the name of the fileset mounted in the directory. A client traversing such a mount point looks up the fileset name in the fileset location database, which tells it which server hosts the fileset. The client then contacts that server to follow the rest of the path. The effect is that DFS provides a single global name space that is shared by all clients. Unlike NFS, the name space isn’t assembled on each client, but is built into the directory hierarchy.

CS 167 (^) XXVII–13 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

Strict Consistency in DFS

fs system users projects sol7 osf bin bin usr bin

twd motif dce

Client

Client

Client

Client

Client

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

DFS maintains a cache of recent file requests on disk (or, for diskless workstations, in memory). DFS file servers hand to a client an object known as a token (the dark ovals in the slide), which informs a client that its cached copy of the file (within a range of bytes) is (still) valid. There are a number of different types of tokens, e.g. read tokens and write tokens, depending upon what the client is doing with the file. As long as the client’s cache manager holds that token, operations on the file can be satisfied locally without any network requests for data. Tokens are revoked when a request comes into the file server that is incompatible with the tokens held by clients, e.g. a write request that changes data on the server while clients hold read tokens for the same file and same byte range. Files are copied between DFS file servers and DFS clients in units called chunks. The default chunk size for clients with caches stored on disk is 64K, but it can range from 8K to 256K.

CS 167 (^) XXVII–14 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DFS Tokens (1)

fs system users projects sol7 osf bin bin usr bin

twd motif dce

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

Client

File A: Read:0-

File B: Write:0-

File A: Read:0-

File B: Write:513-

DFS uses tokens to ensure Unix single-system semantics across a distributed environment. A token can be thought of as a certificate, manufactured by the file server and delivered to the client, that gives the client a set of rights to perform certain specified operations in its cache. Tokens contain a type field that specifies the particular operation (DATA_READ, DATA_WRITE, STATUS_READ, STATUS_WRITE, LOCK_READ, LOCK_WRITE, OPEN_EXCLUSIVE, OPEN_READ, OPEN_WRITE, OPEN_SHARED, OPEN_DELETE, OPEN_PRESERVE, SPOT_HERE, SPOT_THERE). In addition, DATA and LOCK tokens contain a byte range and apply only to data within that range. Two tokens are said to be compatible if they can be held by different clients simultaneously, for example, two DATA_READ tokens for the same range of bytes in the same file. Tokens are said to be incompatible if the semantics of the two tokens conflicts. For example, if a client requests a DATA_WRITE token for a particular range of bytes in a file, any outstanding DATA_READ or DATA_WRITE tokens must first be revoked and returned to the file server.

CS 167 (^) XXVII–16 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DFS Tokens (3)

fs system users projects sol7 osf bin bin usr bin

twd motif dce

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

Client

File A: Read:0-

File A: Read:0-

Revoke(A, Read, 0-4095)

If one client is to be modifying the file, then, for consistency, no other clients should be reading the file. Thus the server sends a revoke request to the other client, demanding that it give back its read token for the file.

CS 167 (^) XXVII–17 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DFS Tokens (4)

fs system users projects sol7 osf bin bin usr bin

twd motif dce

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

Client File A: Read:0-

Grant(A, write, 0-4095)

File A: Write:0-

The server now grants write access to the original client by giving it a write token for the desired portion of the file.

CS 167 (^) XXVII–19 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DFS Tokens (6)

fs system users projects sol7 osf bin bin usr bin

twd motif dce

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

Client File A: Read:0-

File A: Write:0-

Revoke(A, write, 0-4095)

The server must now send a revoke request to the first client, asking for both the write token and the modified portion of the file.

CS 167 (^) XXVII–20 Copyright © 2006 Thomas W. Doeppner. All rights reserved.

DFS Tokens (7)

fs system users projects sol7 osf bin bin usr bin

twd motif dce

Client

FLDB

FLDB

FLDB

Server

Server

Server

Server

Client File A: Read:0-

File A: Read:0-

Grant(A, read, 0-4095)

Finally, a new read token is granted to the second client.