| title: | Re Not able to generate race condition pl |
|
On Sun, May 10, 2009 at 4:56 PM, Chetan Nanda <chetannanda@xxxxxxxxx wrote:
On Fri, May 8, 2009 at 7:34 PM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx
wrote:
On Fri, May 8, 2009 at 4:42 PM, Chetan Nanda
I am still confused, as every thread will be having its own register set
and
this set will get stored in its tast_struct at each context switch and
at
next run registers will get populated from corresponding task_struct.
So how these variable will get shared between different threads? I am
missing any basic thing?
The original poster use pthreads, and pthreads are created by using
CLONE_VM flag of clone() syscall. That means, theyre sharing task
struct, process address space etc.
AFAIK, each thread or process in kernel has its own task_struct. It is not
shared with any other thread though several elements of this, like
signal_struct, fs_struct, may be shared with other threads in system.
Now at every context switch all processor registers (called hardware context
of a thread) get stored in task_struct. Thus each thread will be having a
local copy of all processor registers. Thus there will not be any race
condition in program posted by original poster. CMIMW
Thanks,
Chetan Nanda
regards,
Mulyadi.
The race condition in OPs code can be easily reproduced by making the
LOOPCOUNT to 10000 and running the program multiple times on a SMP
machine.
So, I am unable to follow the arguments about thread private registers
etc. Anything missing here?
Regards,
Sandeep.
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at rel="nofollow" kernelnewbies.org/FAQ kernelnewbies.org/FAQ
|