delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/27/13:35:04

From: iuser AT mtts DOT perm DOT ru
Newsgroups: comp.os.msdos.djgpp
Subject: preemption in real mode and stack size
Date: 27 Jun 2000 16:42:40 +0300
Organization: unknown
Lines: 36
Distribution: world
Message-ID: <200006271442.TAA10706@localhost.localdomain>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000619173815 DOT 27216T-100000 AT is>
NNTP-Posting-Host: news.litech.net
Mime-Version: 1.0
X-Trace: ah.litech.net 962113363 28031 193.232.65.49 (27 Jun 2000 13:42:43 GMT)
X-Complaints-To: usenet AT ah DOT litech DOT net
NNTP-Posting-Date: 27 Jun 2000 13:42:43 GMT
X-Return-Path: iuser AT mtts DOT perm DOT ru
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019