Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!decvax!tektronix!tekig!tekig4!brianr From: brianr@tekig4.TEK.COM (Brian Rhodefer) Newsgroups: comp.sys.amiga Subject: Re: How do I force a context switch? Message-ID: <1771@tekig4.TEK.COM> Date: Fri, 7-Aug-87 19:27:12 EDT Article-I.D.: tekig4.1771 Posted: Fri Aug 7 19:27:12 1987 Date-Received: Sun, 9-Aug-87 08:37:06 EDT References: <8708070015.AA10387@cogsci.berkeley.edu> Reply-To: brianr@tekig4.UUCP (Brian Rhodefer) Organization: Tektronix, Inc., Beaverton, OR. Lines: 44 May I interject some questions into the "context switch" discussion? The Amiga's multitasking has me mystified. I am using it on blind faith and a prayer, with next to NO idea of what it is really doing, and would greatly appreciate some advice. 1) If Task A, running at priority P, sends a Signal to Task B, which is sleeping at priority P+1, what happens? Does "A" go to sleep immediately, or only after its current timeslice is exhausted? Does the same go for posting a message to one of B's ports? 2) Where do interrupts fit in the scheme of things? I presume that they are able to interrupt even the highest priority tasks; is this true? (further naive questions deleted...) It occurs to me that a little concerted fooling around with some test programs would be helpful. If I find anything interesting or counterintuitive, I'll post. Meanwhile, would either of the following two methods result in forcing a context switch? 1) If "Signal"ing does indeed force a re-evaluation of the task to run, why not spawn a simpleminded little task, at an extremely high priority, such as 125 or so, which endlessly (except for some devilishly clever termination mechanism) "Wait"s for a signal? To force a switch, just send the dimwit task the signal it's waiting for. You get suspended, it gets awakened, and it immediately puts itself back to sleep. If I read Amiga Writ aright, a fresh evaluation of all suspended tasks, including the one which sent the signal, should ensue. 2) Does the "Change Task Priority" (or whatever it's called) routine have immediate effect? (i.e., if Task A promotes sleeping task B's priority above that of A, does A get chloroformed?) If so, setting one's own task's priority to the same value it already has might force the kind of context switch that's sought, without the extra clutter of a slave task. Foolishly hoping to understand my Amiga BEFORE its EPROMs evaporate, Brian Rhodefer