written 8.7 years ago by |
- A file data resides in the cache of multiple nodes. The modification propagation policy specifies when the master copy of a file at the server node is updated upon modification of a cache entry and not about the files residing on other nodes.
- A client’s cache entry becomes stale when some other client modifies the data corresponding to the cache entry in the master copy of the file.
- It becomes necessary to check if the data cached at a client node is consistent with the master copy. If it is not then the cached data must be invalidated and the updated version must be fetched from the server. There are basically 2 approached to verify the validity if cached data –
1. Client-initiated Approach
In this method the client contacts the server to check if locally cached data is consistent with the master copy. File-sharing semantics depends on the frequency of the validity check and can use the below approaches.
i. Check before every access The main purpose of caching is defeated in this process because the server has to be contacted on every access. But this is supported by UNIX like semantics.
ii. Periodic Check
For this method a check is initiated after fixed intervals of time. But this method results in fuzzier file-sharing semantics because the data on which an access operation is performed is time dependent
iii. Check on file open
- A client’s cache entry is validated only when the client opens a corresponding file for use. This method is used for supporting session semantics.
- The validity check is performed by comparing the time of the last modification of the cached version of the data with the servers master copy version. If both are same, then the caches data is up to date or it is stale and hence the current version of the data is fetched from the server. Here version numbers or checksums are used instead of timestamps.
2. Server-Initiated Approach:
- In this method a client informs the file server when it opens a file indicating whether the file is being opened for reading, writing or both.
- The file server keeps a record of which client has which file opened and in what mode. Thus a server keeps a track of the file usage modes being used by different clients and reacts in case of inconsistency.
- Inconsistency occurs when more clients try to open a file in conflicting modes.
- Example: If a file is open for reading, other clients may can open it to read without any problem, but not for writing. Similarly a new client must not be allowed to open a file which is already open for writing. When the client closes the file it sends intimation to the server along with any modification made to the file. On receiving the intimation the server updates its record of which client has which file open in what node.
Problems in server-initiated approach:
i. It violates the traditional client-server model. This makes the code for client and server programs irregular and complex.
ii. It requires that file servers be Stateful.
iii. A check-on-open, client-initiated cache validation approach must still be used along with server-initiated approach.