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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:a2d0:: with SMTP id l199-v6mr1344934ioe.129.1537617298547; Sat, 22 Sep 2018 04:54:58 -0700 (PDT) X-Received: by 2002:aca:f5cc:: with SMTP id t195-v6mr29339oih.0.1537617298251; Sat, 22 Sep 2018 04:54:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!x81-v6no186009ita.0!news-out.google.com!z5-v6ni183ite.0!nntp.google.com!x188-v6no185050ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 22 Sep 2018 04:54:57 -0700 (PDT) In-Reply-To: <624734c8-0cca-4d4d-bedf-ee61428c235a@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=176.10.164.41; posting-account=IWGXAgoAAAAN22gxH4FLrPfxoHPdumnx NNTP-Posting-Host: 176.10.164.41 References: <624734c8-0cca-4d4d-bedf-ee61428c235a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <31050d1c-dfa7-495b-8169-b9b8069a5828@googlegroups.com> Subject: Re: Watchdog-Timer Assignment From: Alex Injection-Date: Sat, 22 Sep 2018 11:54:58 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54405 Date: 2018-09-22T04:54:57-07:00 List-Id: > I looked at your codes. I did not know exactly what you meant by "part 1"= and "Part 2".=20 >=20 > Anh Vo These are the instructions I have been given: PART 1: Write a cyclic scheduler which manages three procedures: F1, F2 and F3. We = demand the following for the executions: F1 should be executed every second. F2 starts when F1 terminates. 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 ass= umed 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. Let the functions print an informative message when they execute, e.g. F1 executing, time is now: 0.00001 F2 executing, time is now: 0.00004 F3 executing, time is now: 0.50008 F1 executing, time is now: 1.00008 F2 executing, time is now: 1.00010 F1 executing, time is now: 2.00007 F2 executing, time is now: 2.00008 F3 executing, time is now: 2.50007 ... Note: Some amount of jitter in start times for functions F1 and F3 cannot b= e avoided. However, the start times of the functions are not allowed to "dr= ift" further and further away from the schedule. PART 2: (The one I am stuck on). Modify F3 from Part 1 so that it occasionally takes more than 0.5 seconds t= o 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 s= hould immediately print a warning message. I.e., 0.5s after start of F3, ei= ther F3 has finished or the watchdog has printed a message. The watchdog sh= ould 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 t= hat F1 is started at whole seconds.