An atomic operation is an operation that can only be done once at a certain "tick" time, eventhough another same operation is simultaneously performed by another thread on another CPU core.
For example
Code:
mkdir /home/flag
is an atomic operation (without the -p option)
so that even if you submit it many time
hi guys.
can we use fread and fwrite with pipes to write data more than PIPE_BUF atomically since they lock FILE object until I/O operation finish? (1 Reply)
Hello,
I need to implement a locking system in C. My problem is how to make the check if the lock file exist and locking it atomic operation.
I want to make something like this:
FILE* lock_fname;
lock_fname = fopen ( "file.lock", "r");
/*check if file exsists*/
if (lock_fname)
{
fclose... (7 Replies)
if I rename a dir
mv dir dir2
Is this operation atomic? Suppose there 100 files in dir, does linux rename them one by one or at once?
In other words, is there a time at which both dir and dir2 exist, with dir has, say 30 files and dir2 has the rest 70 files? (4 Replies)