Sleeping or blocking an interrupt handler

This is a discussion on Sleeping or blocking an interrupt handler within the C++ Programming forums, part of the General Programming Boards category; Assume: 1) Multi-cpu environment 2) Process that gets interrupted, is the same process that executes the interrupt handler, so I ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    2

    Sleeping or blocking an interrupt handler

    Assume: 1) Multi-cpu environment 2) Process that gets interrupted, is the same process that executes the interrupt handler, so I guess technically nothing gets interrupted except what the process was doing before, but it is still executing as it is executing the handler. 3) There is no top or bottom half, when an interrupt takes place the handler is invoked, executes, then return from interrupt, simple as that.

    Why would sleeping the handler (puts in sleep queue, context switch to next runnable process) be a bad idea?

  2. #2
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    What's your guess? We'll work from there.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    2
    Well the only problem I can think of is it would also sleep the interrupted proc, but what if this is what you want or is allowed?

    Or could the problem be it somehow prevents the interrupt from triggering again during the sleep?
    Last edited by jackb; 12-02-2010 at 03:45 PM.

  4. #4
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    >> Or could the problem be it somehow prevents the interrupt from triggering again during the sleep?
    That's what I was thinking. What would happen if another CPU wakes the sleeping handler, then the handler that interrupted it returns to the same process? It would appear to me that the possibility of executing the interrupted handler twice would be introduced in some cases.

    Maybe if you temporarily set CPU affinity in the sleeping task to only allow it to run on the interrupted CPU, the problem would be eliminated. But, there's really no gain from doing so, and there has to be at least a small amount of overhead for adding it to the sleep queue.

    Reentrant handlers can get really complex, have fun!

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    2,508
    Obvious question what is triggering the process change?
    In some designs it is the Interrupt handler that triggers process change/switching.

    Edit: Also, are you maybe confusing process and processor in your description.

    The below makes as much sense to me.
    2) Processor that gets interrupted, is the same processor that executes the interrupt handler, ...

    Tim S.
    Last edited by stahta01; 12-03-2010 at 12:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with interrupt handler
    By afflictedd2 in forum C Programming
    Replies: 2
    Last Post: 02-18-2010, 09:35 AM
  2. How's interrupt handler?
    By lchunr in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-22-2003, 08:10 PM
  3. interrupt handler functions in Visual C++ 6.0
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-07-2002, 06:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21