Re: Multi-threading access to device drivers.

From: Poul-Henning Kamp (phk_at_phk.freebsd.dk)
Date: 11/07/04

  • Next message: Poul-Henning Kamp: "Re: Multi-threading access to device drivers."
    To: Matthew Dillon <dillon@apollo.backplane.com>
    Date: Sun, 07 Nov 2004 08:48:39 +0100
    
    

    In message <200411070357.iA73vaqU040765@apollo.backplane.com>, Matthew Dillon writes:
    >:As was quoted POSIX, the update should be atomic.. so my reading of
    >:that is that you lock the fd, when you read the offset from the fd,
    >:you need to also update the offset with the number of bytes read, so
    >:that a racing read both doesn't drop any data, nor duplicate any data..
    >:
    >:i.e. single file with fixed records, it should be perfectly safe to
    >:throw five threads looping doing a read processing of the records w/o
    >:fear of duplicate records, or dropped records...
    >:
    >:And if we handle it in this manner, then you can allow multiple reads
    >:into the driver...
    >:
    >:--
    >: John-Mark Gurney Voice: +1 415 225 5579
    >
    > If it's a regular file [...]

    BZZZT! Wrong, but thanks for playing. (We are talking devices here)

    -- 
    Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
    phk@FreeBSD.ORG         | TCP/IP since RFC 956
    FreeBSD committer       | BSD since 4.3-tahoe    
    Never attribute to malice what can adequately be explained by incompetence.
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Poul-Henning Kamp: "Re: Multi-threading access to device drivers."

    Relevant Pages

    • Re: Multi-threading access to device drivers.
      ... :that is that you lock the fd, when you read the offset from the fd, ... :you need to also update the offset with the number of bytes read, ... required to guarentee atomicy. ... linux when reading and writing a single file. ...
      (freebsd-arch)
    • Re: Lockless file reading
      ... > The kernel doesn't prevent this, because it doesn't hold any exclusive ... > lock between the writer and reader during the data transfers. ... File offset pointers. ... There aren't mutually exclusive flag changes, ...
      (Linux-Kernel)
    • Reading Binary into array.
      ... has helped my application move along way from theory stage to working ... so the offset can just work within the ... array rather than reading the file constantly of the drive. ...
      (microsoft.public.vb.general.discussion)
    • Re: digital offset printing prices
      ... We have litho and digital, and the breakeven point> depends on the size of the image and bindery work to be done. ... > Second, Offset simply refers to the fact that a right reading image is> printed directly to a blanket as wrong reading, which is then printed> again to the actual sheet as right reading. ... Before Alois Senefelder came along, all> litho printing was done direct, not offset. ...
      (comp.publish.prepress)
    • Re: full duplex "fifo"/"named pipe" - treat program STDIN/STDOUT as file?
      ... They have to be - think about reading a byte at a time. ... The second time you see the cookie ... a request for a few bytes at a given offset. ... and it hasn't been "done" - proc does it badly. ...
      (comp.os.linux.misc)