Mailinglist Archive: opensuse-programming (52 mails)

< Previous Next >
Re: [suse-programming-e] The meaning of atomic in write()
  • From: Verdi March <cincaipatron@xxxxxxx>
  • Date: Sat, 1 Apr 2006 17:33:00 +0800
  • Message-id: <200604011733.01081.cincaipatron@xxxxxxx>

On Saturday 01 April 2006 03:23, Jerry Feldman wrote:
> In the above code, there is a race condition in that either the
> parent or the child writes first, so the second data written will be
> written to a location beyond where the first data was written.
> Whether the parent or child writes first depends on a number of
> things.

yep, the lesson that I learned. Initially I expect that 'atomic'
covers both the location pointer and the 'no interleaving of bytes
up to a certain size'. Turns out that the first is not.

And the occurrance of the race condition varies among platforms.
I used a shell script that repeatedly executes the program. The shell
script stops until the race condition occurs. On SUSE 9.3 and FC4
(64-bit Opteron), the race condition can occur pretty fast, while on
SunOS it does not occur (but maybe it's because I didn't run the
script long enough).


< Previous Next >
List Navigation