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:da12:: with SMTP id x18-v6mr36044999iob.28.1537569338291; Fri, 21 Sep 2018 15:35:38 -0700 (PDT) X-Received: by 2002:a9d:2306:: with SMTP id j6-v6mr403148otb.3.1537569338100; Fri, 21 Sep 2018 15:35:38 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!x188-v6no107092ite.0!news-out.google.com!z5-v6ni103ite.0!nntp.google.com!x81-v6no107741ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 21 Sep 2018 15:35:37 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=146.5.2.21; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.21 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Watchdog-Timer Assignment From: Shark8 Injection-Date: Fri, 21 Sep 2018 22:35:38 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54396 Date: 2018-09-21T15:35:37-07:00 List-Id: On Friday, September 21, 2018 at 4:29:10 AM UTC-6, Alex wrote: > Hello, I have a school assignment (I have heard that this is important to= mention) which I need help with. >=20 > You can find my code here: https://ideone.com/LIWmJM >=20 > My assignment is this: >=20 > Modify F3 from Part 1 so that it occasionally takes more than 0.5 seconds= to execute. >=20 > 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. >=20 > The watchdog task should be started (released) at the same time as (or ju= st before) F3 starts executing, and from that point measure the time that F= 3 uses. >=20 > When F3 misses its deadline the cyclic executive should re-synchronize so= that F1 is started at whole seconds. >=20 > You should start with this skeleton code: part 2. Examine the code to und= erstand how a task is declared inside an Ada program. Try to modify it in p= laces indicated by the comments. You can also reuse your solution for part = 1 as the initial code. >=20 > (P.S The skeleton code "part 2" is more or less an empty Watchdog task-bo= dy). >=20 > I have implemented a random delay for f3 so that it occasionally takes mo= re than 0.5 seconds to execute. My biggest issue (I believe) is that (if f3= takes more than 0.5 seconds to execute) f1 is supposed to start over at th= e next whole second. >=20 > I dont know where I should put that delay for this to happen. >=20 > Thank you in advance! Have you tried getting the current time, doing the math to find the next se= cond, and then doing a delay there?