www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/12/14:50:54

From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: True Processor-aided PM multitasking
Date: Tue, 12 Nov 1996 18:10:15 GMT
Lines: 48
Message-ID: <847822218.17951.1@abwillms.demon.co.uk>
References: <3283D4F5 DOT 79E8 AT flash DOT net>
NNTP-Posting-Host: abwillms.demon.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Glenn Dunham <gbdflyer AT flash DOT net> wrote:

>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.

Wouldn't it be cool to implement a pseudo-preempted threading
system... what I mean is, the timer interrupt sets a "Time to task
switch" flag, and returns quickly.

The compiler has been adjusted to insert "Should I yield?"
instructions at frequent points in the code (one per loop construct,
certainly, and one per 100 or so instructions).

The "Should I yield?" is a simple compare-the-flag, and if the switch
flag is set, PUSHAD (save all registers to the stack) and invoke the
task switch function, then POPAD and continue execution.

The "should I yield?" thus clobbers no registers, ever.

This means less work is done in an interrupt, which means less crashes
during development! The drawback is the slight overhead of frequent
compares to the flag. Also, we'd have to tinker with GCCs innards to
make it insert regular conditional yield instructions...


Worth thinking about...


ABW
--

"Simply drag your mother in law's cellphone number from the
Address Book to the Laser Satellite icon, and the Targeting
Wizard will locate her. Then follow the onscreen prompts for
gigawattage and dispersion pattern..."

(Windows for Early Warning and Defence User's manual P385)

Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.abwillms.demon.co.uk/">Hello :-)</A>

- Raw text -


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