Re: locking question in the SMP era

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

 



 

 
On 9/8/05, Thomas Petazzoni <thomas.petazzoni@xxxxxxxx> wrote:
Hi,

Roy Smith wrote:

> where am I wrong here ?

You're wrong in the fact that a kernel module _doesn't_ run: it's not an
active entity like a process or a thread.

The code of a kernel module gets executed only in the context of an
active entity: either a kernel thread, a user-space process, or an
interrupt handler.
 
Thanks a lot for clearing things out for me !

The locking to provide will depend on what does the module, and how it
is used by the active entity using it (through a syscall, through a
/proc interface, through a Netlink socket, or something else).
 
let's assume the simplest model where my module export a /proc entry,
which is nothing more than a window to a static buffer, which the user
can read from and write to, nothing more.
in this case, I guess multiple users, on SMP systems, can concurrently
access the buffer, thus a locking mechanism is required (on the static buffer alone).
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 ?
 

If you don't provide details about what you're trying to do, nobody will
be able to help you.
 
As for my problem, it is not specific to any need, just
a sudden misunderstanding I'm trying to solve.

And again, the locking problem appears also in uni-processor systems,
not only on SMP-systems.

Sincerly,

Thomas
 
Thanks !!

--
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx


[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