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!feeder.eternal-september.org!aioe.org!.POSTED.DFxaDADwSkn+6wW9Ah21PA.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Scheduling behaviour issue Date: Wed, 22 Apr 2020 12:34:48 +0100 Organization: Aioe.org NNTP Server Message-ID: NNTP-Posting-Host: DFxaDADwSkn+6wW9Ah21PA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (darwin) Cancel-Lock: sha1:0aELCKWMRSN6Ri0AjQgVQHWnxVQ= X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:58459 Date: 2020-04-22T12:34:48+01:00 List-Id: As some will recall, I've based my Cortex GNAT RTS[1] (for ARM Cortex-M devices, so far) on FreeRTOS[2]. I've now discovered an unfortunate difference between what the ARM requires at D.2.3(9)[3] and the way FreeRTOS behaves. What we need is A task dispatching point occurs for the currently running task of a processor whenever there is a nonempty ready queue for that processor with a higher priority than the priority of the running task. The currently running task is said to be preempted and it is added at the head of the ready queue for its active priority. but FreeRTOS adds the preempted task at the *tail* of its ready queue ([4], section Prioritized Pre-emptive Scheduling (without Time Slicing), on page 95 or thereabouts). I can see that this will make an application less predictable, but I don't think it'll make a correct application misbehave. I've been having some trouble thinking of a way to demonstrate the (mis)behaviour! [1] https://github.com/simonjwright/cortex-gnat-rts [2] https://www.freertos.org [3] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-D-2-3.html#p9 [4] https://bit.ly/2VK7slM