Is write system call atomic if data > buffersize
I am one of the developers for CSQL MMDB open source software on linux platform (linux 2.6 kernel version). We are generating redo logs (data) for recovery of the database.
Multiple threads might be writing huge chunks of data to the file using write system call.
We are opening the file in O_CREAT | O_APPEND mode.
Is writing the data to the file ( more than the write buffer size) atomic? Or will it corrupt the file?
Suppose if buffer size is 8kb, and
process A is writing 10 kb and
process B is writing 1 kb simultaneously,
Will the data be written into the file as 10kb of A and then 1kb of B or
can it corrupt the file by writing 8kb of A and 1 kb of B and then 2kb of A?
Will the file system take care of the atomicity or should we employ any atomicity resources like semaphores or mutexes?