Mulyadi Santosa wrote: > Hi > > On Thu, Oct 16, 2008 at 3:50 AM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote: > >> Hello , >> >> I want to understand how kernel handles signals delivering between processes. >> Can you guide me through kernel code , or provide some basics ideas. >> > > For basic idea, I could propose this kind of concept: think of it like > posting a message to destination (in this case...a task). After it is > posted to a target, rescheduling is called to make sure the target > process pick it up ASAP. of course there is no guarantee that process > will run right away since it's possible for example higher prio > runnable process is sitting in the run queue. > Also a kernel code while running in process context can check weather there is a pending signal while it was in TASK_INTERRUPTIBLE state (after it becomes runnable) by calling signal_pending() and act accordingly. The kernel saves the signal that is sent to a process that is not currently running, in the task descriptor. (while can be later checked by the process). > Let's assume the process is selected by scheduler and executed. Also > let's assume it's going from kernel space back to user space. Kernel > will notice there is "a message" sitting and determine what that is. > If it's SIGKILL or any other unmodifiable signal (no way to change the > handle), kernel handler will be engaged. > > If kernel notice it needs to call user space handler, it will jump > into the related EIP in user space. At the same time, kernel will > modify the stack of the target process so that when it finished > executing the handler, sigreturn will be called so task will jump back > into the kernel path. And then it returns to normal flow, that is > going back to the path before the task entered kernel space. > > I might missed something, so feel free to CMIIW people... > > regards, > > Mulyadi. > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ