Re: locking question in the SMP era

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Roy Smith wrote:

> in this case, I guess multiple users, on SMP systems, can concurrently

Grrrrr. I already told you 2 or 3 times that the problem doesn't only
occur on SMP systems, it also occurs on UP systems !

> access the buffer, thus a locking mechanism is required (on the static buffer 
> alone).

Yes, as the buffer is a global shared resource, it has to be protected
against concurrent accesses.

> on the other hand, automatic variables are created locally for each thread of 
> execution,
> and are not shared amongst the per-cpu thread of execution, so no need to lock
> them.
> is this true ?

Yes local variables (declared inside functions) are allocated on the
stack, which is particular to each thread. So there's no need to do
locking for local variables.

Thomas
-- 
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux