Re: Write is not atomic?
> This seems out of context. > If the file was open(2)ed with O_APPEND, the file offset is first > set to the end of the file before writing. The adjustment of the > file offset and the write operation are performed as an atomic > step. > Sounds different, doesn't it? Yes, it does -- thanks for the clarification. (And thanks to Dave for the interesting tests.) Sorry for the confusion, -- Juliusz -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Write is not atomic?
> You don't check return code here, does write succeed at all? Yes, both writes return 6. > Does it ever produce e.g. OuOuilleille No. > (as this is what atomicity is about here)? I was referring to the claim that under Linux writing and adjusting the file offset are performed as an atomic step, not to the atomicity of the write operation itself. -- Juliusz -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Write is not atomic?
Hi, The Linux manual page for write(2) says: The adjustment of the file offset and the write operation are performed as an atomic step. This is apparently an extension to POSIX, which says This volume of IEEE Std 1003.1-2001 does not specify behavior of concurrent writes to a file from multiple processes. Applications should use some form of concurrency control. The following fragment of code int fd; fd = open("exemple", O_CREAT | O_WRONLY | O_TRUNC, 0666); fork(); write(fd, "Ouille", 6); close(fd); produces "OuilleOuille", as expected, on ext4 on two machines running Linux 3.2 AMD64. However, over XFS on an old Pentium III at 500 MHz running 2.6.32, it produces just "Ouille" roughly once in three times. Sorry for not being able to give more test cases, but I cannot easily change either the filesystem or the kernel on the Pentium server. -- Juliusz Chroboczek P.S. I'll appreciate being copied with any replies. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [REPORT] cfs-v4 vs sd-0.44
> Oh I definitely was not advocating against renicing X, Why not do it in the X server itself? This will avoid controversial policy in the kernel, and have the added advantage of working with X servers that don't directly access hardware. Con, if you tell me ``if you're running under Linux and such and such /sys variable has value so-and-so, then it's definitely a good idea to call nice(42) at the X server's start up'', then I'll commit it into X.Org. (Please CC both me the list, so I can point any people complaining to the archives.) Juliusz - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/