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!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Two-stage suspend operations Date: Wed, 11 May 2016 09:55:51 +0100 Organization: A noiseless patient Spider Message-ID: References: <17d09c96-c5e6-4238-9adb-c1dab5611237@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="078609b24ac737343a0c37340c7a7a6a"; logging-data="10561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18egZFfXnuhtlu95R5zww7rfw9Y9FCYt5s=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:l09ZTzlShCjvr8ngaWsfSghusCc= sha1:QI6FvXrjNs+SXZjsETZ2tOwbCxI= Xref: news.eternal-september.org comp.lang.ada:30383 Date: 2016-05-11T09:55:51+01:00 List-Id: rieachus@comcast.net writes: Thanks for the notes. >> I'm looking at a system[1] where I'm assured that we need to run a >> drone's motor controller at 20 kHz, and SOs seemed a possibility. Of >> course, if you need to avoid concurrency problems between a timer-driven >> ISR and tasking code, using SOs isn't going to work! so we are looking >> at swing-buffering or possibly GNAT's Lock_Free pragma/aspect[2]. > > It sounds like you need rate-monotonic scheduling: > https://en.wikipedia.org/wiki/Rate-monotonic_scheduling Usually you > would run one clock at the highest priority and dispatch lower > priority tasks every N ticks for some N. The Liu Sha and John > Goodenough paper tells how to implement RMS in Ada. Notice though > that there is a lot of math for you to do to assign priorities and > prove that your system does not exceed a load limit. It turns out that the 20 kHz is in a separate processor from the main application. Nothing like an enthuse-potential-volunteers description of a project for generating confusion. > Note BTW, that the GNAT pragma specifically allows the protected > objects that only run in the context of another task/thread, have a > high enough priority not to be interrupted, and do not reference any > lower priority protected objects. Can you tell me where this is documented? Also, there seems very little difference between using Lock_Free and Atomic: you can't have entries, and, when 'Contents' is an array of integers, lock_free.adb:3:07: illegal body when Lock_Free given lock_free.adb:3:58: type of "Contents" must support atomic operations > This is a sufficient but not necessary condition to insure that these > POs are not involved in deadlocks. To need POs you will have multiple > (Ada) tasks, and you need a different way to prove they are deadlock > free. Also are you planning to allow running on more than one > physical processor? From experience you need to test on one, two, and > three or more logical CPUs to verify deadlock and livelock free > operation. Only mono-processor at the moment. I didn't mention that we are using Ravenscar, I thought that precluded deadlock?