There are two alternatives for the signal delivery

This preview shows page 6 - 8 out of 16 pages.

There are two alternatives for the signal delivery scenario: 1. Signals are delivered to a dedicated thread which does not execute any user code (or at least no code which is not willing to receive all possible signals). The drawbacks are the costs for the additional thread and, more importantly, the se- rialization of signals. The latter means that, even if the dedicated signal thread distributes the handling of signals to other threads, first all signals are funneled through the signal thread. This is contrary to the intend (but not the words) of the POSIX signal model which allows parallel handling of signals. If reaction time on signals is an issue an application might create a number of threads with the sole purpose of handling signals. This would be defeated by the use of a signal thread. 2. Signals can be delivered to the user level with a different mean. Instead of using the signal handler a separate upcall mechanism is used. This is what would be used in a Scheduler Activation based implementation. The costs are increased complexity in the kernel which would have to implement a second signal delivery mechanism and the userlevel code has to emulate some signal functionality. For instance, if all threads block in a read call and a signal is expected to wake one thread up by returning with EINTR this must continue to work. In summary, it is certainly possible to implement the signal handling of a M-on-N implementation at user-level but it is hard, a lot of code, and it is slowing down normal operations. Alternatively the kernel can implement the POSIX signal handling. In this case the kernel will have to handle the multitude of signal masks but this will be the only problem. Since the signal will only be sent to a thread if it is unblocked no unnecessary interruptions through signals occur. The kernel is also in a much better situation to judge which is the best thread to receive the signal. Obviously this helps only if the 1-on-1 model is used. 6
Image of page 6

Subscribe to view the full document.

Draft 5.3 Helper/Manager Thread Or Not In the old thread library a so-called manager thread was used to handle all kinds of internal work. The manager thread never executes user code. Instead all the other threads send requests like ’create a new thread’ which were centrally and sequentially executed by the manager thread. This was necessary to help implementing the correct semantics for a number of problems: To be able to react to fatal signals and kill the entire process the creator of a thread constantly has to watch all the children. This is not possible except in a dedicated thread if the kernel does not take over the job. Deallocation of the memory used as stacks has to happen after the thread is finished. Therefore the thread cannot do this itself.
Image of page 7
Image of page 8
You've reached the end of this preview.
  • Spring '12
  • GwangS.Jung
  • Native POSIX Thread Library, POSIX

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern