Mail Archives: djgpp/2000/06/27/13:35:04
On Mon, 19 Jun 00 17:38:34 +0300, Eli Zaretskii wrote:
> I suggest to do the task switch from a signal handler for
> SIGALRM. You can use the `setitimer' library function to get periodic
> SIGALRM.
> The disadvantage of this method is that threading stops when one of
> the threads calls DOS or BIOS, until the DOS/BIOS call returns.
> However, by and large, this is the only way of multitasking in the
> DPMI environment that doesn't violate the DPMI spec.
I am working on small realtime system.
The system must have short response time, so it is essential
to preempt task which is in real mode (executes DOS
disk operation, for example).
I want hook RTC realmode interrupt vector and make switching to
protected mode by DPMI raw mode switch function (returned by fn 0x0306).
Thus I can use my protected mode stack, not DPMI's ( PMODE/DJ allows
to do it, but experiments on CWSDPMI gave me indistinct result ).
From my protected mode stack I can switch to another task.
Am I on the right road?
> > How much memory must I allocate per stacks just to be save?
> There's no single answer to that question. DJGPP programs get 512KB
> of stack by default, and that is enough for most programs, so if you
> want to be safe, use 512KB per thread.
I don't use recursion and deeply nested calls. What minimum
stack size per thread would be sufficient? Are there some libc
functions, which require such large stack?
With best regards, Ignat Korneyev.
P.S. I hope that someone will understand what I have written.
- Raw text -