Tahnks guys!
2013/1/30 Karaoui mohamed lamine mohar...@gmail.com
thanks, i think i get it.
2013/1/30 valdis.kletni...@vt.edu
On Tue, 29 Jan 2013 20:16:26 +0100, you said:
Actually my question is :
Does POSIX specifies the fact that we need to use lockf to be able
to do
read/write
Multiple concurrent write() by different thread is possible, as they all
can share the same file descriptor in a single similar process, and this is
not allowed. So nevertheless, the problem you posed is not
allowed/acceptable by the kernel, so Linus himself fixed it:
See here:
Very nice!
2013/2/7 Peter Teoh htmldevelo...@gmail.com
Multiple concurrent write() by different thread is possible, as they all
can share the same file descriptor in a single similar process, and this is
not allowed. So nevertheless, the problem you posed is not
allowed/acceptable by the
To generalize further u can safely say that all synchronous operation have
to be thread-safe, except for some APIs as listed here:
http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_09.html
linux kernel may guarantee thread-safety - but this only apply to
serializing data at the
actually i dont see why there is a need to ptovide a lock by the kernel.
the locking should be at userspace.
you can test it by massive write to a file, that would demonstrat the
kernel
didnt confer a lock
sent from my samsung
Hello,
I was looking at how a syscall read/write was done, and i
in ANY updates/changes, locking is always needed, to prevent multiple
parties from updating at the same time. but there is another way:
lockless updates. one form done in linux kernel is called RCU:
http://en.wikipedia.org/wiki/Read-copy-update
the logic is whenever someone want to change,
On Tue, 29 Jan 2013 16:56:02 +0100, Tobias Boege said:
Look some lines above:
struct fd f = fdget(fd);
That creates a reference, not a lock. It basically assures that
the system doesn't reap and reclaim that fd out from under the code.
(In other words, it's managing lifetime, not
2013/1/29 Tobias Boege tob...@gambas-buch.de
On Tue, 29 Jan 2013, Karaoui mohamed lamine wrote:
Hello,
I was looking at how a syscall read/write was done, and i found this :
loff_t pos = file_pos_read(f.file);
ret = vfs_read(f.file, buf, count, pos);
On Tue, 29 Jan 2013 18:25:19 +0100, Karaoui mohamed lamine said:
This function is supposed to return the file reference, does do the locking?
Refcounting only, no locking provided by fdget.
It seems that i can't find the lock instruction( with all those rcu
instructions, i am little lost),