Tutorial Week 15
A procedure ``incr2'' takes two arguments, and adds one to each argument. Discuss
what happens in the procedure call
incr2(x, x)
if the parameters are
a) call by value.
b) call by reference.
c) IN OUT parameters.
Ans:
a) no changes are made externally. b) x gets incremented twice, becaussse it
is referenced twice from within the procedure. c) x gets incremented once.
Each local copy of x is incremented, and then the two local copies are restored.
(Ada is apparently ambiguous as to whether (b) or (c) is done in that language.)
If a remote procedure call attempts to read the first block of a file, this
can be re-done any number of times, so that ``at least once'' semantics can
be used for retries. How about writing the first block? Writing a later block?
Ans:
The first block can be done any number of times, as it always starts at zero.
Later blocks probably could not if the server keeps track of the file pointer,
but could if the client did.
How can the ``session semantics'' method be implemented for a client running
on a different machine to the server? How can session semantics be implemented
locally, using say the Unix file system?
Ans:
A copy would be made, changed, and replaced. Locally, it would probably have
to be done the same way, with at least some of the inode info copied (eg block
pointers). Some could be ignored, such as owner, date, etc.
Suppose clients cache files while making changes to them. A way of resolving
the cache coherence problem could be to examine the ``last modified'' time
of the file on the host and in the cache to decide if the server copy is correct.
Are there any problems in this?
Ans:
The two clocks must be logically synchronised or this breaks down.
When a request to open a file is made on a local (Unix) file system, the file
system uses the information in the inode such as owner, group and permission
flags to determine whether the file access can be made. What security mechanisms
could be used in a distributed file system? Is there a difference in a remote
file system where the server maintains state, versus a stateless system?
Ans:
Locally, Unix uses the user-id. This would be meaningless on a remote system
because user-ids may not be the same. The name would have to be used. This
would need validation on the server side. If the client was ``trusted'' then
that might be enough, if untrusted,a password may be needed. In a stateless
system, some verification would be needed for each transaction. This would
have to be fast.
Laboratory Week 15
There will be no laboratory this wek. Use the time for completing tutorial
exercises,
lab exercises, or revision.