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!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: RFC: Prototype for a user threading library in Ada Date: Tue, 12 Jul 2016 10:37:42 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <58b78af5-28d8-4029-8804-598b2b63013c@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Mozilla-News-Host: news://news.aioe.org X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:31073 Date: 2016-07-12T10:37:42+02:00 List-Id: On 2016-07-11 21:40, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:nlnl0b$93q$1@gioia.aioe.org... >>> I don't think it is possible to create implementation-independent code for >>> those sorts of deadlines, and as such it doesn't really matter from a >>> language perspective how that's done (it won't be portable in any case). >> >> I don't see why. Any reasonable implementation would do. An implementation >> that does not preempt lower priority tasks is not reasonable. If you >> wanted to push the argument you would end up with disabling hardware >> interrupts. > > Your definition of reasonable and mine are obviously incompatible. Hardware > interrupts are evil; possibly a necessary evil but still evil and one wants > to minimize them as much as possible. Obviously you disagree. What is evil in hardware interrupts? It is a piece of hardware serving certain purpose. There is no moral component there from the software developing POV, especially because no alternative solution ever existed. >>> I'm unconvinced that the way to ensure that "urgent activies" are done is >>> some sort of magic (and priorities are essentially magic). I'd rather make >>> sure that no task is hogging the system, and avoid overcommitting. That >>> usually happens naturally, and in the unusual case where it doesn't, there's >>> almost always someplace where adding a synchronization point (usually a >>> "Yield" aka delay 0.0) fixes the problem. >> >> No it does not and it is a *very* bad design, because it distributes >> making the decision to switch to the parts of the software which must know >> nothing about the reason when switching is necessary. E.g. that a task >> solving some differential equation decides whether to switch to the >> keyboard interrupt handler. That belongs to the keyboard driver, not to >> the equation solver. > > Wrong. In this scheme *all* software switches, all the time. Only the task > supervisor is making any decisions, but it is getting the opportunity to do > so at reasonable intervals. Neither the keyboard nor the diffy-Q solver has > anything to do with it. The keyboard driver is at the receiving end, as a subscriber to the interrupt, or keyboard event. Solver and other tasks sharing the processor have nothing to do with that. Whether all events must be routed through the supervisor is an implementation detail. In any case the supervisor is not a part of the software, it is an OS/RTS component, thus non-existent from the SW design POV. > I agree that having to put in such choices manually isn't a good idea, but I > wasn't suggesting that (outside of user-written I/O that doesn't use > language-defined or implementation-defined libraries). The compiler would do > it at appropriate points. How is that different then? If the compiler inserts re-scheduling code after each few instructions, that logically is *exactly* same as re-scheduling at timer interrupts, except than incredibly inefficient. This would be nothing but poor-man's preemptive scheduling. My point was that we need non-preemptive user-controlled (explicit, cooperative) scheduling of certain tasks on top of the standard schema. And this looks much simpler to implement than code insertions you suggested. >> It is just like arguing for return codes over exceptions. > > Given that almost none of this is visible to the Ada user, I don't see the > analogy. (And certainly, return codes are much more efficient than > exceptions; the problem is the distribution of concerns. That's not > happening here.) The analogy is that instead of signaling an event (exception, scheduling event) at its source with the advantage of hardware acceleration, you poll for the event state all over the code. Doing that you lose hardware support and you have a huge problem with third party libraries that does succumb to your schema. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de