R. Clayton (rclayton@monmouth.edu)
(no date)
When should the read-write lock be unlatched? At the completion of the
requested i/o operation or at the end of the system call (at this stage the
i/o request is submitted to the device and queued).
The os should unlatch the lock when it's safe for the user process to access
the buffer passed in with the system call. When that is depends on your
implementation. With enough buffering the os could unlatch the lock when a
write system call returns, but that won't be possible for a read.
Also, what are the valid values of n for terminal r/w ? Within the process
boundary, or just non-negative value, or a valid number of words within user
space ?
It should certainly be non-negative. Process address-space boundaries are
still enforced, so terminal reads and writes should involve only legitimate
user-process addresses; n should be judged accordingly.
The interesting question is what should the os do when n = 1000000? I've
implemented it both ways: declaring the system call immediately invalid, or
waiting until the terminal (or the disk, for that matter) tries to access an
invalid address (if it ever does). For this assignment, given that the os
implements a line-oriented terminal discipline, the first way seems more
appropriate (as well as being the easier of the two ways to implement).
This archive was generated by hypermail 2.0b3 on Mon Dec 16 2002 - 22:00:05 EST