Multi-threading access to device drivers.

Poul-Henning Kamp phk at phk.freebsd.dk
Sat Nov 6 23:48:49 PST 2004


In message <200411070357.iA73vaqU040765 at 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 at 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.


More information about the freebsd-arch mailing list