The HyperNews Linux KHG Discussion Pages

## Timing of slow I/O / locking of resources

  Forum: Device Drivers
  Keywords: slow I/O, scheduling, identification of accesses
  Date: Sat, 14 Mar 1998 06:01:41 GMT
  From: Horvai Peter <horvai@ens.fr>

I have a few simple questions on writing modules, for which I didn't find the answer (well, maybe it's still there) in the khg. I need to time out writes to a very slow and primitive device, I can send a byte per millisecond (_not_ microsecond), and the device delivers no interrupts and is not pollable. How should I do the timing? Secondly, if I would like to implement a locking policy, so that procedures having already an open file descriptor on my device can obtain the lock, I must be able to identify the different procedures + file-descriptors accessing the driver. I suppose that this stuff is in the struct file * structure, but it is unclear to me how exactly this information is coded. Finally, returning to the first question, how can I delay a procedure in driver (kernel) space, can I call usleep(), or use setitimer(), and may I use schedule() to yield control for some time if my I/O is really slow, and continue the next time the procedure is schedueld (I don't want to have an EINTR or sort). Thanks a lot.