tags:

views:

167

answers:

1

We have the following code in VxWorks:


sig_hdr () { ... }
task_low_priority() {
    ...
    // Install signal handler for SIGUSR1
    signal(SIGUSR1, sig_hdr);
    ...
}
task_high_priority() {
    ...
    kill(pid, SIGUSR1); //pid is the ID of task_low_priority
    ...
} 

The high priority task sends a signal (via kill) to the low priority task. Will the high priority task be pre-empted and the low priority task execute right away, or will the signal be deferred until the low priority task gets to run?

+1  A: 

Sending a signal is not a blocking operation. The signal handler will only be executed when the task it is registered with has the processor.

In this particular case, the signal handling would be deferred until the low priority task executes.

The implication is that signal handling could be delayed indefinitely if the task with the handler does not run.

This is valid for kernel operations. In Real-Time Processes, the signal handling is a bit different in that the first available task in the RTP will execute the signal handler.

Benoit