ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/09/09:33:30

From: Glenn Dunham <gbdflyer AT flash DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: True Processor-aided PM multitasking
Date: Fri, 08 Nov 1996 18:48:53 -0600
Organization: Flash-Net Internet Service Provider, 888-FLASHNET
Lines: 30
Message-ID: <3283D4F5.79E8@flash.net>
Reply-To: gbdflyer AT flash DOT net
NNTP-Posting-Host: lpm1-18.flash.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've noticed some threads concerning threads/tasks in DJGPP, but none
seem to address the fact that if you want to use processor-protected
tasks like in winNT/unix, each task must have a TSS entry in the GDT.
The task swapper hooks a timer that will activate it every so often
so it can switch to any task it wants by jumping to/calling the TSS 
entry in the GDT (so says Intel documentation).  In order for an OS 
to properly thread the kernel must deal with nested tasks and so forth
by properly maintaining each TSS that might need to be rescheduled or
something.

I plan to write a program that will thread at least two simultaneous
tasks (but definitely more would be better) by allowing the main()
module to set up the swapper and let the subroutines be threaded by it.
For this type of program, the swapper may not be needed if cooperative
multitasking would be adequate; each task would jump to the other's GDT
entry when it completed that iteration, or basically yielding processor
time when it's ready.

One problem:  I know of no DJGPP functions that allow allocation of GDT
selectors.  (DPMI only allows LDT allocation.)  One possible solution 
would be to copy the GDT to a 64kb segment (I believe the max. GDT size
is 64K, or 8192 quadword descriptors) and repoint the GDTR to it.  (FSDB
reported a GDT of only about 32 descriptors while I was running one of
my programs.)  This would allow the program to have plenty of space to
allocate TSS selectors, etc....

Is that the only way?


Glenn Dunham

- Raw text -


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