> 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 running > another function of its own, modA_func_1()? > > 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? 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. It doesn't work that way, the module in itself only provides some more code in the kernel, although it normally calls some register hooks for whatever it is providing (register_chrdev(), register_blkdev(), ...). So, any number of processes can be executing the same code in the kernel at the same time. And as the processes have different stacks inside the kernel, there won't be a problem _unless_ the function touches global variables, then you need to take a look at how locking works. If you need something to be done before doing something else, wait queues might be of interest. Essentially, a module never runs anything on its own, there's always a process behind it. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/