lkml.org 
[lkml]   [2003]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Lockless file reading
From
On Wednesday, Aug 27, 2003, at 16:40 Europe/Helsinki, Richard B. 
Johnson wrote:

> So I don't see how you could ever have a sequence of 123 written,
> with both '1' and '3' written, but not '2'. It is only the stuff
> on the 'ends' that can be incomplete.

That's pretty much what I was assuming without knowing how the kernel
internally really works.

> Anyway, if you want two (or more) processes to access the file,
> you should mmap it. You can configure a mmap'ed file so that
> updates appear to all readers. However, just like any shared-memory
> access, you need some kind of synchronization, perhaps a semaphore,
> so that you always read valid data. Usually one only needs
> __valid__ data, not necessarily __current__ data.

Right, that's why I don't really need read locking. The
double-writing/reading with memcmp() checking was supposed to check
that the data is valid.

I'm already using shared mmaps, but I was thinking that supporting NFS
would be nice as well. That'd work pretty much the same as write()s.

Maybe it would be possible to use some kind of error detection
checksums which would guarantee that the data either is valid or isn't,
regardless of the order in which it is written. I don't really know how
that could be done though.

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

\
 
 \ /
  Last update: 2005-03-22 13:48    [from the cache]
©2003-2011 Jasper Spaans