Sub-optimal libc's read-ahead buffering behaviour

Maxim Sobolev sobomax at portaone.com
Thu Aug 4 08:58:44 GMT 2005


On Thu, Aug 04, 2005 at 10:08:30AM +0400, Andrey Chernov wrote:
> On Thu, Aug 04, 2005 at 10:02:51AM +0400, Andrey Chernov wrote:
> > No surprize. Single read can be consider as sort of "atomic" operation.
> > But between read & seek character device itself can move its pointer in 
> > anyplace.
> 
> No only move the pinter, but change contents too. Consider reading 
> /dev/mem

Actually this is good example which supports my point, since with the
current behaviour when doing 2 subsequent reads each of them less than
4K in size you will get either outdated data from the second read or
even worse - mix of the old data and the new data when second read crosses
buffer boundary!

I think that any buffering should be disabled for reading from chardev
no matter how "historic" our current behaviour is.

-Maxim


More information about the freebsd-current mailing list