From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: GNAT and Tasklets
Date: Wed, 17 Dec 2014 17:58:00 -0600
Date: 2014-12-17T17:58:00-06:00 [thread overview]
Message-ID: <m6t5a9$8m1$1@loke.gir.dk> (raw)
In-Reply-To: m6t1f1$5th$1@dont-email.me
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]
"Björn Lundin" <b.f.lundin@gmail.com> wrote in message
news:m6t1f1$5th$1@dont-email.me...
> On 2014-12-17 23:08, Randy Brukardt wrote:
>> "Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
>>> As I remember, the user-level thread solution in GNAT had the drawback
>>> that if one thread blocked on an OS call, the whole program was blocked.
>>
>> True, but that's not a real problem in most software (that has to respond
>> in
>> human timescales - if you need microsecond response times, forget
>> Janus/Ada!).
>
> That kind of rules out a common pattern we have in communication
> processes.
Certainly not: my web and mail servers do plenty of communication!
> Usually we set up a socket, globally, in a package body.
>
> One task does a blocking select() - thus hanging on it - for say 5-30 s.
Here's the problem, you're thinking at much too low of a level. The Claw/NC
sockets libraries abstract sockets comminucation into an I/O model (no such
thing as "select"!). And the implementation can avoid actual blocking (even
though at the call level you will see what appears to be blocking).
Get (My_Socket, Timeout => 30.0, Item => Buffer, Last
=> Last);
This will appear to block for 30 seconds, but it surely doesn't have to be
*implemented* that way.
For servers, there is a server object. "Greet" returns an open socket for a
connection. Again, this appears blocking, but doesn't have to be implemented
that way.
[Truth-in-advertising notice: The Claw libraries actually do block. I wrote
an abstraction extension on top of them that don't block -- but those use
the exact same subprogram profiles, so there's no operational difference.]
I don't see any sense to the other tasks that you have (I realize I don't
understand the precise problem that you are trying to solve). But it all
seems WAY too low-level to me; the reason for using such a pattern is that
you need high speed responsiveness (far faster than human speeds) --
otherwise sticking with a simple I/O model is much easier to understand for
maintenance.
On top of which, using the same (Ada) object from two different tasks
without synchronization is an invalid use of shared variables. Such a
program is technically erroneous, and as such, it could do anything at all.
So I'm dubious that your pattern even works on other compilers (regardless
of the blocking issue). It's unfortunate that Ada doesn't have any static
checking for such things, because it's all too easy to write something that
works today but won't work in the future.
Randy.
next prev parent reply other threads:[~2014-12-17 23:58 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 16:31 GNAT and Tasklets vincent.diemunsch
2014-12-11 10:02 ` Jacob Sparre Andersen
2014-12-11 16:30 ` Anh Vo
2014-12-11 18:15 ` David Botton
2014-12-11 21:45 ` Egil H H
2014-12-11 23:09 ` Randy Brukardt
2014-12-12 2:28 ` Jacob Sparre Andersen
2014-12-12 8:46 ` vincent.diemunsch
2014-12-12 23:33 ` Georg Bauhaus
2014-12-13 2:06 ` Brad Moore
2014-12-13 6:50 ` Dirk Craeynest
2014-12-14 0:18 ` Hubert
2014-12-14 21:29 ` vincent.diemunsch
2014-12-16 5:09 ` Brad Moore
2014-12-17 13:24 ` vincent.diemunsch
2014-12-16 4:42 ` Brad Moore
2014-12-17 13:06 ` vincent.diemunsch
2014-12-17 20:31 ` Niklas Holsti
2014-12-17 22:08 ` Randy Brukardt
2014-12-17 22:52 ` Björn Lundin
2014-12-17 23:58 ` Randy Brukardt [this message]
2014-12-18 10:39 ` Björn Lundin
2014-12-18 23:01 ` Randy Brukardt
2014-12-19 8:39 ` Natasha Kerensikova
2014-12-19 23:39 ` Randy Brukardt
2014-12-19 8:59 ` Dmitry A. Kazakov
2014-12-19 11:56 ` Björn Lundin
2014-12-20 0:02 ` Randy Brukardt
2014-12-18 8:42 ` Dmitry A. Kazakov
2014-12-18 8:56 ` vincent.diemunsch
2014-12-18 9:36 ` Dmitry A. Kazakov
2014-12-18 10:32 ` vincent.diemunsch
2014-12-18 11:19 ` Dmitry A. Kazakov
2014-12-18 12:09 ` vincent.diemunsch
2014-12-18 13:07 ` Dmitry A. Kazakov
2014-12-19 10:40 ` Georg Bauhaus
2014-12-19 11:01 ` Dmitry A. Kazakov
2014-12-19 16:42 ` Brad Moore
2014-12-19 17:28 ` Dmitry A. Kazakov
2014-12-19 18:35 ` Brad Moore
2014-12-19 20:37 ` Dmitry A. Kazakov
2014-12-20 1:05 ` Randy Brukardt
2014-12-20 17:36 ` Brad Moore
2014-12-21 18:23 ` Brad Moore
2014-12-21 19:21 ` Shark8
2014-12-21 19:45 ` Brad Moore
2014-12-21 23:21 ` Shark8
2014-12-22 16:53 ` Brad Moore
2014-12-21 21:35 ` tmoran
2014-12-21 22:50 ` Brad Moore
2014-12-21 23:34 ` Shark8
2014-12-22 16:55 ` Brad Moore
2014-12-22 23:06 ` Randy Brukardt
2014-12-20 16:49 ` Dennis Lee Bieber
2014-12-20 17:58 ` Brad Moore
2014-12-19 19:43 ` Peter Chapin
2014-12-19 20:45 ` Georg Bauhaus
2014-12-19 20:56 ` Dmitry A. Kazakov
2014-12-19 23:55 ` Randy Brukardt
2014-12-19 23:51 ` Randy Brukardt
2014-12-18 22:33 ` Randy Brukardt
2014-12-19 13:01 ` GNAT�and Tasklets vincent.diemunsch
2014-12-19 17:46 ` GNAT?and Tasklets Brad Moore
2014-12-20 0:39 ` GNAT and Tasklets Peter Chapin
2014-12-20 9:03 ` Dmitry A. Kazakov
2014-12-20 0:58 ` GNAT�and Tasklets Randy Brukardt
2014-12-18 9:34 ` GNAT and Tasklets Niklas Holsti
2014-12-18 9:50 ` Dmitry A. Kazakov
2014-12-17 21:08 ` Brad Moore
2014-12-18 8:47 ` vincent.diemunsch
2014-12-18 21:58 ` Randy Brukardt
2014-12-17 22:18 ` Randy Brukardt
2014-12-18 0:56 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox