comp.lang.ada
 help / color / mirror / Atom feed
* ADA Tasks
@ 2002-12-02  2:37 Khuram Imtiaz
  2002-12-02  4:56 ` James S. Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Khuram Imtiaz @ 2002-12-02  2:37 UTC (permalink / raw)


Is it possible to have tasks which contain both (entries/accepts and
calls).Could this be a bad idea? If so, why? can someone explain it
with a pseudo code. I would appreciate your help in this regard.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-02  2:37 ADA Tasks Khuram Imtiaz
@ 2002-12-02  4:56 ` James S. Rogers
  2002-12-02  6:56 ` Richard Riehle
  2002-12-02 15:15 ` Robert A Duff
  2 siblings, 0 replies; 8+ messages in thread
From: James S. Rogers @ 2002-12-02  4:56 UTC (permalink / raw)


"Khuram Imtiaz" <khurmie@hotmail.com> wrote in message
news:a5a588a6.0212011837.5e378fd6@posting.google.com...
> Is it possible to have tasks which contain both (entries/accepts and
> calls).Could this be a bad idea? If so, why? can someone explain it
> with a pseudo code. I would appreciate your help in this regard.

There are two fundamental ways for tasks to communicate with
each other. The oldest is the Rendezvous. The newest is
protected objects.

The Rendezvous provides direct, synchronous communication
between tasks. Protected objects allow indirect, asynchronous
communication through shared data.

There is no way to define a "call" other than an Entry or a
protected operation between tasks.

Jim Rogers





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-02  2:37 ADA Tasks Khuram Imtiaz
  2002-12-02  4:56 ` James S. Rogers
@ 2002-12-02  6:56 ` Richard Riehle
  2002-12-02 15:15 ` Robert A Duff
  2 siblings, 0 replies; 8+ messages in thread
From: Richard Riehle @ 2002-12-02  6:56 UTC (permalink / raw)


Khuram Imtiaz wrote:

> Is it possible to have tasks which contain both (entries/accepts and
> calls).Could this be a bad idea? If so, why? can someone explain it
> with a pseudo code. I would appreciate your help in this regard.

An important point to remember about an entry is that it has a queue.
A subprogram does not have a queue.   In concurrency this is important
because an entry call is not a call for immediate action.   Rather, an
entry call simply places an entry ( a request for action) in the queue.

Almost every other mechanism in tasking relies on this simple idea.
For example, timed entry calls, conditional entry calls, asynchronous
transfer of control, etc. all depend on the notion of an entry queue.

If a task had a subprogram, we would expect an immediate response
upon calling it.   At the very least, we would expect the call to
be re-entrant.  That would have some strange implications for any
active object (task).

On the other hand, a passive object (protected object) can accomodate
the mixture of entries and subprograms quite easily.

Hope this is helpful.

Richard Riehle






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-02  2:37 ADA Tasks Khuram Imtiaz
  2002-12-02  4:56 ` James S. Rogers
  2002-12-02  6:56 ` Richard Riehle
@ 2002-12-02 15:15 ` Robert A Duff
  2002-12-02 15:46   ` Jean-Pierre Rosen
  2 siblings, 1 reply; 8+ messages in thread
From: Robert A Duff @ 2002-12-02 15:15 UTC (permalink / raw)


khurmie@hotmail.com (Khuram Imtiaz) writes:

> Is it possible to have tasks which contain both (entries/accepts and
> calls).Could this be a bad idea? If so, why? can someone explain it
> with a pseudo code. I would appreciate your help in this regard.

Yes, a task is allowed to contain both entries/accepts and entry calls.
There is nothing particularly "bad" about it, if it meets your needs.
For example, task A might call task B's entry, and as part of the work
in (or after) the accept statement in B, B might call an entry of task
C.

However, protected objects are often a better way to communicate than
rendezvous, because they decouple the communicating tasks.  They are
also more efficient on many implementations.

- Bob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-02 15:15 ` Robert A Duff
@ 2002-12-02 15:46   ` Jean-Pierre Rosen
  2002-12-03 14:37     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Pierre Rosen @ 2002-12-02 15:46 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 681 bytes --]


"Robert A Duff" <bobduff@shell01.TheWorld.com> a �crit dans le message news:
wccbs44qwoz.fsf@shell01.TheWorld.com...
> khurmie@hotmail.com (Khuram Imtiaz) writes:
>
> However, protected objects are often a better way to communicate than
> rendezvous, because they decouple the communicating tasks.  They are
> also more efficient on many implementations.
>
However, they make proper termination more difficult, and are (IMHO) of
lower level than rendezvous.
As usual, having a choice means that you have to make a choice...

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-02 15:46   ` Jean-Pierre Rosen
@ 2002-12-03 14:37     ` Dmitry A. Kazakov
  2002-12-03 22:06       ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry A. Kazakov @ 2002-12-03 14:37 UTC (permalink / raw)


On Mon, 2 Dec 2002 16:46:45 +0100, "Jean-Pierre Rosen"
<rosen@adalog.fr> wrote:

>"Robert A Duff" <bobduff@shell01.TheWorld.com> a �crit dans le message news:
>wccbs44qwoz.fsf@shell01.TheWorld.com...
>> khurmie@hotmail.com (Khuram Imtiaz) writes:
>>
>> However, protected objects are often a better way to communicate than
>> rendezvous, because they decouple the communicating tasks.  They are
>> also more efficient on many implementations.
>>
>However, they make proper termination more difficult,

... and they are unable to exchange data. Technically it is possible
using Requeue, but it is so painful and error prone that one should
better use rendezvous [for that].

>and are (IMHO) of lower level than rendezvous.

A level measured in what? (:-)) They are really difficult to compare.
But both have the same problem, they do not very support refactoring.
Neigther protected object nor task can be extended or split, leaving
the interface intact.

>As usual, having a choice means that you have to make a choice...

!

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-03 14:37     ` Dmitry A. Kazakov
@ 2002-12-03 22:06       ` Simon Wright
  2002-12-04 13:52         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2002-12-03 22:06 UTC (permalink / raw)


Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> writes:

{re: tasks vs protected objects

> But both have the same problem, they do not very support
> refactoring.  Neigther protected object nor task can be extended or
> split, leaving the interface intact.

Do you have something in mind that allows refactoring _and_
concurrency?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ADA Tasks
  2002-12-03 22:06       ` Simon Wright
@ 2002-12-04 13:52         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry A. Kazakov @ 2002-12-04 13:52 UTC (permalink / raw)


On 03 Dec 2002 22:06:44 +0000, Simon Wright <simon@pushface.org>
wrote:

>Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> writes:
>
>{re: tasks vs protected objects
>
>> But both have the same problem, they do not very support
>> refactoring.  Neigther protected object nor task can be extended or
>> split, leaving the interface intact.
>
>Do you have something in mind that allows refactoring _and_
>concurrency?

No. Ada is the single language which seriously tries to express
concurrency. Others are more or less just toys. So there is nothing to
compare with.

If you ask whether it is possible to do it, then I believe it should
be possible, but a long way to go.

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-12-04 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-02  2:37 ADA Tasks Khuram Imtiaz
2002-12-02  4:56 ` James S. Rogers
2002-12-02  6:56 ` Richard Riehle
2002-12-02 15:15 ` Robert A Duff
2002-12-02 15:46   ` Jean-Pierre Rosen
2002-12-03 14:37     ` Dmitry A. Kazakov
2002-12-03 22:06       ` Simon Wright
2002-12-04 13:52         ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox