[comp.sys.amiga.tech] Task Switching

jdp@caleb.UUCP (Jim Pritchett) (03/02/90)

[ Munch a bunch of Fritos (tm) - instead of this line.]

Is there some sort of task switch interrupt chain?  I'm probably not
describing this correctly.  What I would like to do is to somehow have
my C code called each time that the Amiga switches tasks.  (I want to
check some things and identify which task just swapped out.)  Is this
doable?  Is it too difficult?  Any suggestions?

                                Thanks,


--

                                                Jim Pritchett


UUCP:  {attctc|texbell}!letni!dms3b1!caleb!jdp
 or    texbell!rwsys!caleb!jdp

valentin@cbmvax.commodore.com (Valentin Pepelea) (03/04/90)

In article <7779.AA7779@caleb> jdp@caleb.UUCP (Jim Pritchett) writes:
>
>Is there some sort of task switch interrupt chain?  I'm probably not
>describing this correctly.  What I would like to do is to somehow have
>my C code called each time that the Amiga switches tasks.  (I want to
>check some things and identify which task just swapped out.)  Is this
>doable?  Is it too difficult?  Any suggestions?

Well, the only approved way doing something similar is using the
(*tc_Switch)() and (*tc_Launch)() fields of a task control block. These
fields point to functions which are to be called when that particular
task loses or regains control.

In order to trap every single arbitrary task switch, you'd have to SetFunction()
the Switch() function, but even that would not trap interrupt context
switches. (interrupts run as separate "micro-tasks" - Bryce's term) Needless
to say, this is totally unsupported and is likely to lead to truble with
future versions of the operating system.

Now, what do you mean by "...and identify which task just swapped out." Are
you trying to implement virtual memory? I would find that very interesting.

Valentin
-- 
The Goddess of democracy? "The tyrants     Name:    Valentin Pepelea
may distroy a statue,  but they cannot     Phone:   (215) 431-9327
kill a god."                               UseNet:  cbmvax!valentin@uunet.uu.net
             - Ancient Chinese Proverb     Claimer: I not Commodore spokesman be