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: border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Simp,e example for 2 tasks Date: Mon, 22 Sep 2014 10:18:37 +0300 Organization: Tidorum Ltd Message-ID: References: <9b22dd09-6137-4f4b-8be1-28255032df70@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: individual.net 512rG0MyrahPI487Xb3lAQOHBZbGC9mJmz2LKkFdLlTvXS3lUk Cancel-Lock: sha1:5hpTzY4XngtmVHeyxGkOjCyH3fU= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Xref: number.nntp.dca.giganews.com comp.lang.ada:189081 Date: 2014-09-22T10:18:37+03:00 List-Id: On 14-09-21 23:33 , Jeffrey Carter wrote: > On 2014-09-21 7:31 AM, Stribor40 wrote: >> Would anyone be able to post simple example of ada program showing 2 tasks >> taking to each other please. For example one task sends message to another >> saying "hi" and second taks replying "hi back". > > As others have pointed out, Ada tasking is based on synchronous communication, > not the message queues found in other languages. This why Ada had to introduce > the partition concept to achieve distribution, while Erlang processes distribute > quite nicely by themselves, as the ping-pong example shows. Hmm... I don't quite agree with that. It seems to me that rendez-vous interaction between tasks could be implemented in a distributed system, as long as the entry parameters can be passed by value or by copy-in copy-out. It is the global shared variables and reference parameters that would make a distributed approach difficult for Ada programs using such constructs. I don't know Erlang well enough to understand if it has some solution for that, or if it simply forbids such things. Of course this does not alter the fact that rendez-vous is synchronous, and that a queue has to be implemented if asynchronous communication is needed. For reque statements, I believe that the RTS typically packs up the entry parameters in a record structure, like a message, which the RTS can manipulate more easily than it could manage parameters pushed on the stack, as for a normal call. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .