Re: Lockless file reading

From: Timo Sirainen (tss_at_iki.fi)
Date: 08/27/03

  • Next message: Alan Cox: "Re: Promise IDE patches"
    Date:	Wed, 27 Aug 2003 17:56:30 +0300
    To: root@chaos.analogic.com
    
    

    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/


  • Next message: Alan Cox: "Re: Promise IDE patches"

    Relevant Pages

    • Re: [Lhms-devel] RE: memory hotremove prototype, take 3
      ... > (possibly incomplete) quick list of what would be needed, ... > 1) the core kernel needs to be independent of physical memory position ... ...vgf orggre jura vgf serr. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Power consumption HZ100, HZ250, HZ1000: new numbers
      ... > but with reasonable hard drive speeds and adult-sized keyboards? ... Pavel picked up that (incomplete) list up from my email, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Y2K-like bug to hit Linux computers! - Info of the day
      ... On Wed, 1969-12-31 at 17:54 -0500, Richard B. Johnson wrote: ... >> nightmares, it's about this date and time. ... It's more FUD. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux-2.4.22
      ... On Tue, 26 Aug 2003, Richard B. Johnson wrote: ... > I configured, built and booted Linux-2.4.22. ... several threads as causing similar type issues...i posted a patch that ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • RE: spurious 8259A interrupt
      ... On Mon, 22 Mar 2004, Richard B. Johnson wrote: ... An I/O APIC can be used for the wirtual-wire mode as well. ... messages travelling across the inter-APIC bus (depending on an APIC ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)