[mythtv] Re: mythtv-dev digest, Vol 1 #174 - 16 msgs

John Coiner mythtv-dev@snowman.net
Fri, 15 Nov 2002 23:45:26 -0500


> Also, in what case(s) is it necessary to have the thread for writing 
> data to the disk (ThreadedFileWriter)?  The implementation is a ring 
> buffer that has data added when Write() is called, then sending that 
> data to the disk in another thread.  Doesn't the write() system call 
> just dump the data to kernel buffers, where it is written when it can 
> be?  The extra thread and memcpy's to implement the ring buffer stuff 
> may not be necessary.  I didn't notice any difference in performance 
> when I removed all of the ThreadedFileWriter code and just had system 
> write() calls.
> 

Usually system write() will return with very little delay, but if there 
is heavy I/O it can have awful latency. Before the ThreadedFileWriter, 
this latency blocked the thread that was running the video encoder. I 
was running into situations where video wasn't encoding fast enough, 
despite available CPU cycles.

The extra memcpy is on the compressed stream, so that's not fatal. If 
people are really worried about it, we could make it a configurable option.

-- john