From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 22 Sep 2018 08:17:59 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Watchdog-Timer Assignment Date: Sat, 22 Sep 2018 09:18:01 -0400 Organization: IISS Elusive Unicorn Message-ID: <3gecqdd52g4j3m5ilnp4tlr578cg4lv9uf@4ax.com> References: <624734c8-0cca-4d4d-bedf-ee61428c235a@googlegroups.com> <31050d1c-dfa7-495b-8169-b9b8069a5828@googlegroups.com> User-Agent: ForteAgent/8.00.32.1272 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-cdFA1xKhyBifn4pbUrfBOE3+fjkRpWnvSf/332xU9vxMDrNvGarBmi1gCLfrGijqyBWL3zp8TqnjkGe!JFvPQ9WevDu3uV/zPR9oHOsfHyVQ3KD+ORleIWS0GSDIDi22Nreua/UAwyD3IVohiTeVT6nm X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3847 Xref: reader02.eternal-september.org comp.lang.ada:54408 Date: 2018-09-22T09:18:01-04:00 List-Id: On Sat, 22 Sep 2018 04:54:57 -0700 (PDT), Alex declaimed the following: >F3 should execute every other (varannan) second, starting 0.5 seconds after F1's start. >The execution times for the functions are not known. However, it can be assumed that F1 and F2 together execute for less than 0.5 seconds, and that F3 does not take more than 0.5 seconds to execute. > So phase one means F1/F2/F3 together take just under 1 second, but F3 alternates... > >Note: Some amount of jitter in start times for functions F1 and F3 cannot be avoided. However, the start times of the functions are not allowed to "drift" further and further away from the schedule. Which means using a DELAY UNTIL to set the start times for F1 and F3; very crude pseudo-code. majorframe = 1; -- second minorframe = 0.5; epoch = now + majorframe; doF3 = true; loop delay until epoch; F1; F2; if doF3 then delay until epoch + minorframe; end if; doF3 = not doF3; epoch = epoch + majorframe; end loop/ > >PART 2: (The one I am stuck on). > >Modify F3 from Part 1 so that it occasionally takes more than 0.5 seconds to execute. > >Augment the cyclic scheduler from Part 1 with a watchdog task to monitor F3's execution time. When F3 exceeds its deadline (0.5s), the watchdog task should immediately print a warning message. I.e., 0.5s after start of F3, either F3 has finished or the watchdog has printed a message. The watchdog should let F3 finish even if it misses its deadline. > >The watchdog task should be started (released) at the same time as (or just before) F3 starts executing, and from that point measure the time that F3 uses. > >When F3 misses its deadline the cyclic executive should re-synchronize so that F1 is started at whole seconds. It is possible to interpret that clause in a way that does NOT require integral seconds for the start time, but only that F1 starts at a time relative to its prior start which is an integral multiple of seconds... epoch + 1 epoch + 2 epoch + ... so if F3 runs long, the watchdog needs to increment the epoch by a whole major frame interval to resynchronize F1 to the NEXT normal period. Assumption is that F3 does not run longer than 1.5 seconds (which would result in it using up a whole major frame and into a second one). If you are going to interpret it to start on an integral second, then the original scheduler itself should start on an integral second. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/