Useful Sticky Notes

Monday, June 18, 2012

Linux Signalling Pains

Attempts to make sense of it all for the general collection of samples from Timer Interrupts.

Edit 6/19/2012: Given the many issues that need to be addressed, I've decided it would be clunky to attempt to complete them here. I will cover each individual topic piece-meal in subsequent posts.

This article will be work-in-progress for now. There are many things that I have explored (and conveniently forgotten), many things I have yet to explore and many more things that need to be fitted together to make any coherent sense of the matter. Portability issues play a big role in this.

Useful information sources:
Signal(7) - linux.die.net/man/7/signal
Thread Local Storage - www.akkadia.org/drepper/tls.pdf
Signal Re-entrancy - http://www.delorie.com/gnu/docs/glibc/libc_493.html

At the top level, THREE things will need to be addressed for our purposes:
  1. The establishment of timer-interrupts. I currently know of two ways of doing this: through the setitimer call (sys/time.h); or through the timer_create call (signal.h, time.h, link with -lrt).
  2. The handling of signals and signal masks. Choices of signals for this purpose are SIGPROF or SIGALRM. Masks need to be handled as necessary through sigprocmask. Edit 6/19/2012: sigprocmask is probably not sufficient for our needs. The alternative is signal(SIGPROF, SIG_IGN). I believe the trouble with the latter is that it applies to the entire process, so very careful handling with respect to threads is required.
  3. Working with threads. Considerations have to be made for threads like the use of pthread_sigmask and the not-so-portable use of thread local storage like __thread tls.
 That is it for now. Will attempt to get a more complete picture later.

No comments:

Post a Comment