Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cfa!willner From: willner@cfa.harvard.EDU (Steve Willner) Newsgroups: comp.lang.forth Subject: Re: Multi-user Forth Message-ID: <645@cfa.cfa.harvard.EDU> Date: Wed, 19-Aug-87 13:38:00 EDT Article-I.D.: cfa.645 Posted: Wed Aug 19 13:38:00 1987 Date-Received: Sat, 22-Aug-87 01:36:29 EDT References: <9.2122EF36@circle.UUCP> <2573@tekgvs.TEK.COM> Organization: Harvard-Smithsonian Ctr. for Astrophysics Lines: 31 Summary: time critical applications have stiffer requirements > In article <9.2122EF36@circle.UUCP> rat@circle.UUCP (David Douthitt) writes: > >I would think that task-switching during NEXT would create too high of an > >overhead. Seems to me that switching during : or ; would be more > >reasonable. However, I would still prefer PAUSE and similar for more > >control. > In article <2573@tekgvs.TEK.COM>, toma@tekgvs.TEK.COM (Tom Almy) writes: > The scheme used in the Multi User Forth that I posted last week changes on > "PAUSE". (This is F83) Changing only on PAUSE certainly makes it easier to write code, but it is far too restrictive in an instrument control application where a task might be time-critical. The alternative is to _patch_ either ; or NEXT. Most of the time the word just executes an extra no-op, but when an interrupt schedules a new task, the interrupt service routine changes the no-op to be a jump to the priority-checking word (PAUSE in many systems), which patches the no-op back in and then gives control to the highest priority process that is ready to run. Of course this scheme isn't needed if _all_ the time-critical processing can be done within the interrupt service routine, but that condition greatly restricts the amount of processing that can be done. The price one pays for the extra capability, of course, is that code must be carefully written to be interruptible; semaphores must be used frequently (and in the right order!), global variables and pointers must be maintained in a fully consistent manner, etc. The benefit is that a real-time process can proceed unaffected by user activities. -- Steve Willner Phone 617-495-7123 Bitnet: willner@cfa1 60 Garden St. FTS: 830-7123 UUCP: willner@cfa Cambridge, MA 02138 USA Telex: 921428 satellite cam