Re: Help - does module run as a single thread process?

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

 



l x wrote:
Hi,

Hi,
I'm working on a module and would appreciate it if
some one could help me on this.

Suppose there are two modules, modA and modB.  What's
going to happen if modB calls a function,
modA_func_2(), defined in modA while modA is executing
another function of its own, modA_func_1()?

When you load a module, you actually link all the global variables and functions to the kernel. So if you define a function in a module A, you will be able to use it in a module B, if module A is loaded.
I need modA completes modA_func_1() before responsing
to modB's call to modA_func_2(). Can I assume kernel
will do this for me?
No you can't. you will have to use wait queues.
If I understand right, a module
runs as a single thread process. Therefore, when
something is running, other requests must wait. Please correct me if I'm wrong.


I think you don't understand the concept of modules. When a module is loaded, the code in the init function is executed and that's all. When the module is unloaded, the code of the exit function is executed.
While the module is loaded, every kernel thread can use the functions defined in you module. That's all. The module aren't execute in a single way.
Thanks,


--
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