Re: On thread scheduling

From: Ray Lee
Date: Sat Sep 15 2007 - 10:54:53 EST


On 9/14/07, Heikki Orsila <shdl@xxxxxxxxxx> wrote:
> Consider a simple embedded system:
>
> void interrupt_handler(void)
> int main(void)
>
> I would like to "emulate" this system with a workstation to make
> development faster. I would create two threads, one executing the
> main() function, and the other occasionally calling interrupt_handler().
> Before interrupt_handler() is called, the main() thread should be
> stopped asynchronously.

Are you open to doing something other than pthreads? Using fork() to
get real processes, and then sending a SIGSTOP (and SIGCONT) to the
one running main() should work.

Or emulating the interrupt arrival with a signal, and having
interrupt_handler() be registered as the signal handler. Of course,
you then have to deal with the constraints that come with signal
handlers, so that can be a bit of a pain depending on what you're
trying to do.

Ray
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/