Mail Archives: djgpp/1996/03/07/22:29:21
On 1 Mar 1996, Holger Vogelsang wrote:
> Here is very simple solution for two processes, using longjmp,
> setjmp for task switching (without preemption).#include <stdio.h>
> This can be expanded for many processes by modifying the "scheduler"
> lwp_switch. This examples works under DJGPP 1.x and DJGPP 2.0.
> The stack size for each process is set to 2000 bytes in this example.
<snip>
I thought of a way to make this technique preemptive; that is, the
function lwp_switch () is actually set up as a signal handler for SIGALRM
or SIGVTALRM, then we use alarm () or setitimer () to "toggle" the
function at a regular rate.
A couple of questions though:
1) is it possible for an alarm to be delivered in the middle of a library
or kernel call? that is, because MS-DOG is nonreentrant. I'm not sure how
the signal delivery mechanism works in DJGPP.
2) what is the resolution of the timer in setitimer ()? the timeval
structure has a tv_usec field, but exactly what is the effective
resolution of this thing? does DJGPP use the 18.2 Hz timer interrupt of
DOS, or is it reprogrammed to interrupt at a faster rate?
Thanks.
------------------------
Orlando A. Andico
oandico AT eee DOT upd DOT edu DOT ph
------------------------
- Raw text -