Re: real-time threaded IO with low latency (audio)

Oliver Xymoron (oxymoron@waste.org)
Sun, 25 Jul 1999 02:13:50 -0500 (CDT)


On Sat, 24 Jul 1999, Bill Huey wrote:

>
> > Oliver Xymoron wrote:
>
> > There's only one very small piece of video capture that needs to be
> > realtime - ie worst case performance of a few milliseconds. That's the
> > piece that sets up the DMA transfers for grabbed frames. That piece
> > belongs in a driver, not an application. The remainder, ie queuing and
> > unqueuing buffers, postprocessing, and spooling to disk, all can be done
> > in application space and rely on the system's buffers. If it can't make it
>
> You mean spooling to a raw parition when non-swappable RAM is overrun ?

No, I mean spooling to a normal filesystem. Ext2 is fast _on average_. It
will get close to the disk bandwidth on average.

But realtime is not about averages, it's about the worst case. The worst
case for filesystems can be pretty ugly - there are a lot of data
structures that have to be updated atomically which means there are locks
that have to be held. There are indirect blocks to write, inodes to
update, seeks to be made. You might take a look at _Design of the UNIX
Operating System_ (Bach) to get an idea of what managing a filesystem in a
kernel actually entails. Consider a heavily fragmented disk. Consider
multiple applications contending for write bandwidth with no predictable
pattern. Consider your drive doing error correction or deciding to
recalibrate periodically. Getting something on the disk may occassionally
take quite a long time. Luckily, since we have memory to buffer images in,
we only really care about the average (nearly optimal) performance.

> > to disk without overrunning memory in that environment, it wouldn't make
> > it anyway.
>
> Yeah, maybe I'm being completely naive in myunderstanding of buss
> bandwidth sharing, but I refuse to accept the *above* given what
> modern graphics hardware can do with AGP2 and disk controllers
> with DMA.

The problem is not the hardware. As I outlined, video spooling is
perfectly doable. The problem is people's insistence that they need
realtime for things they don't, without an understanding of what the costs
of realtime are.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/