Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: polyForth multitasker question Date: Fri, 14 Apr 2017 19:43:03 -0700 Organization: A noiseless patient Spider Lines: 35 Message-ID: <871ssugzm0.fsf@nightsong.com> References: <2ef60cba-5577-4813-ae93-3946cd4b415b@googlegroups.com> <877f2ql73h.fsf@nightsong.com> <8760i9jf0d.fsf@nightsong.com> <91b82032-d469-47a8-8586-b7dfc4dc42ec@googlegroups.com> <46d8a45d-99b8-4f48-a011-f08d4de9e918@googlegroups.com> <8737dcixu5.fsf@nightsong.com> <87vaq7hg4l.fsf@nightsong.com> <87r30vgzd2.fsf@nightsong.com> <87a87ihcxe.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="55e23b86542ccc33df908631a998fc13"; logging-data="4244"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sYmsoLsdSmGjbL8pODSNs" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:4HrIZY7COXn4Wn4p1RyI91+9TfQ= sha1:GIXf+IL3gI6MEW5fRvYYIz93ovU= Xref: csiph.com comp.lang.forth:57341 rickman writes: > They ended up writing the code 100% in interrupts. There was no main > body of code. Our local software guy who was brought into the project > late saw that and blew a gasket. That's a style that I've heard of. If all the stuff in the ISRs was quick enough I thought it was considered ok. > perform a calculation that could take considerable time. .. you would > not want to do that in an interrupt routine. Right. THe ISR would just log the event that the button had been pressed. The calculation then would be done by a scheduled task that picked up the logged event. Thta's why the ISR would wake up the scheduler. > The scheduler runs infrequently for tasks that are low priority and > have little timing consequence. I'd want pressing a button to have quick response (in human terms) if possible, like 100 msec. Are you saying to wake up the cpu at 10 hz, 24 hours a day? That doesn't sound like a good use of power. I'd only want to wake it when someone actually presses a button, which might be months. > I don't know if you are that unfamiliar with the use of interrupts or > if you are just pulling my chain. Maybe I don't understand or maybe we're not using the terminology the same way. I'm envisioning the scheduler as an event loop that reads logged events like timer tickets, button presses, etc. ISR's log the events, and the scheduler reads them and dispatches to tasks. If there are no events to process, the scheduler puts the cpu to sleep. Eventually, some ISR (maybe an alarm) wakes it back up. Seems pretty natural.