next up previous
Next: Synchronous vs. Asynchronous I/O Up: No Title Previous: The Unix I/O Interface

Implementation of Interface Procedures

Can be implemented via semaphores or messages

semaphore implementation

PROCEDURE Read(parameters)
 new(io_request)
 put mode, buffptr, length, fd, process_id, 
     pointers into io_request fields
 P(fileqsem) {get mutual exclusion on request queue}
 insert(fileq, io_request)
 V(fileqsem)
 V(filerequest) {tell file manager work available}
 P(complete) {signalled by file manager}
 return(status) {status = -1 for error}
  {if ok, return value specified in call}
END

message based request transfer

PROCEDURE Read(parameters)
 new(msgbuff)
 put mode, buffptr, length, fd into msgbuff
 SEND(fileman, msgbuff)
 RECEIVE(fileman, status)
 return(status)
END



Omer F Rana
Fri Feb 14 18:33:29 GMT 1997