Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is the write(2) system call atomic



On Sat, 08 Apr 2006 00:31:29 UTC
John Chambers <jc at trillian.mit.edu> wrote:

> I've  always  understood  that  there  was  a  single  per-open  data
> structure that contains things like the kernel file buffer, but there
> was also a per-process structure that contains the offset. Otherwise,
> you'd  have an lseek() call in one process affect the other's offset,
> which would be truly bizarre to try to debug.
I found the answer I was looking for thanks to Robert La Ferla
http://marc.theaimsgroup.com/?l=linux-kernel&m=107375454908544
The relevant part of this is from Linus.
"There are file descriptors that have atomicity guarantees (pipes(, 
but regular files do not". 

The person who originally posted the question on another list had
inferred that write(2) was atomic from the following: "Write  requests
of  {PIPE_BUF}  bytes  or  less   are guaranteed  not to be interleaved
with data from other processes doing writes on the  same  pipe".

-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.blu.org/pipermail/discuss/attachments/20060408/c63590c4/attachment.sig>



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org