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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.164.41 with SMTP id n41mr28516853ioe.18.1467579363893; Sun, 03 Jul 2016 13:56:03 -0700 (PDT) X-Received: by 10.157.53.22 with SMTP id o22mr1157448otc.7.1467579363862; Sun, 03 Jul 2016 13:56:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!r1no10164578ige.0!news-out.google.com!d62ni765ith.0!nntp.google.com!jk6no10128625igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Jul 2016 13:56:03 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=78.192.88.225; posting-account=21X1fwoAAABfSGdxRzzAXr3Ux_KE3tHr NNTP-Posting-Host: 78.192.88.225 References: <58b78af5-28d8-4029-8804-598b2b63013c@googlegroups.com> <1e32c714-34cf-4828-81fc-6b7fd77e4532@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <902ae6b3-9f6d-4161-8f1f-39749d93406a@googlegroups.com> Subject: Re: RFC: Prototype for a user threading library in Ada From: Hadrien Grasland Injection-Date: Sun, 03 Jul 2016 20:56:03 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31016 Date: 2016-07-03T13:56:03-07:00 List-Id: Le samedi 2 juillet 2016 23:33:19 UTC+2, Niklas Holsti a =C3=A9crit=C2=A0: > On 16-07-02 19:49 , Hadrien Grasland wrote: >=20 > > As for deadlocks in event-driven programs, they do occur, but they > > are trivial to detect (since the task graph is explicit, one can just > > look for a cycle in it), >=20 > That is not always enough. In my experience, event-driven programs tend= =20 > to have cycles where one task sends events or "requests" to another, and= =20 > expects "replies" in return. To understand if this causes a deadlock,=20 > livelock, or works well, one must analyse the conditional control flow=20 > in the tasks and consider the feasible/infeasible chains of events. > > > > and good interface design can make it hard > > to trigger accidentally (if the event produced by a task A cannot be > > easily used as a dependency of that same task). >=20 > Good design is a cure for all kinds of deadlocks ;-) >=20 > I don't know if the request/reply event-cycle can be considered bad=20 > design. In the examples I've seen, it was implied and required by the=20 > roles assigned to the tasks. However, these were real-time, embedded=20 > applications, not parallel computation applications. In compute code, it is quite common to model a problem as a combination of = many simple, single-purpose tasks (e.g. "blend two images together", "compu= te the histogram of the resulting picture"). In this kind of pipe-and-filter architecture, it is critical to have cheap = task creation/scheduling and inter-task communication. But on the pro side,= complex task synchronization is less frequently needed, because task tend = to only interact indirectly through dataflow. You avoid modeling I/O as "task A starts an IO task B, then sleeps until B = has completed". You rather model it as "task A performs IO, and feed the ou= tput to task B, which is started as the result of all its inputs being avai= lable". But indeed, I could well see this architecture being less appropriate for o= ther scenario, such as the event loop of a real-time application or web ser= ver.