[Haifux] Implementing read() like UNIX guys like it

Eli Billauer eli at billauer.co.il
Thu Apr 28 14:28:54 MSD 2011

Shachar Raindel wrote:

> Note that if you have already implemented the "give away the CPU while
> no input, until input arrives", adding the delay bit becomes
> relatively simple (storing the jiffies value when writing the first
> byte in the buffer, comparing it to now, if smaller than minimum,
> going into timed sleep).
Actually it's easier. There's wait_event_interruptible_timeout(). So it 
boils down to telling the interrupt routine the minimum number of bytes 
accumulated for a wakeup, and then wake up on enough data or timeout.
> I join the request about the "do tell". I would be especially
> interested in hearing results of benchmark such as "run nice'd CPU
> intensive task in parallel to the hardware interacting task, check
> change in time-to-complete the CPU intensive task".
I'll be back when I start doing the stress testing. It will take me a 
while to get there, though...


Web: http://www.billauer.co.il

More information about the Haifux mailing list