From: Paul Rubin <no.email@nospam.invalid>
Subject: Re: Toy computational "benchmark" in Ada (new blog post)
Date: Thu, 06 Jun 2019 23:38:21 -0700
Date: 2019-06-06T23:38:21-07:00 [thread overview]
Message-ID: <87imthx5lu.fsf@nightsong.com> (raw)
In-Reply-To: 4c95ff02-43c4-44aa-ab65-db688f0c2e17@googlegroups.com
David Trudgett <dktrudgett@gmail.com> writes:
>> Yes I'll see if I can rework the C++ code to not launch new threads at
>> each run.
> It doesn't matter if you don't time that part of the execution. But
> I'm guessing that would be hard in C++.
I used the C++ futures/async feature which in principle could use a
thread pool, but in GCC 6 I'm told that it launches a new thread for
each async. Otherwise I used what I think is the same strategy as the
Ada code:
for Worker in Worker_Range loop
Tasks (Worker).Run
(Start_Idx => Idx_Ranges (Worker, Low),
Finish_Idx => Idx_Ranges (Worker, High));
end loop;
It looks like you have a static array of worker threads, and I'm
guessing that the .Run message some kind of event to a worker to tell it
to run the task body. I didn't try to figure it all out though. Does
Ada automatically create an event loop in each task to receive those
messages? If yes, that's pretty cool.
Is there a request queue between the main program and each worker? What
happens if it gets too large? Is there a way to share a single queue
between a bunch of workers?
I read "Ada Distilled" some time back but iirc it didn't say much about
this. I've been wanting to get a more detailed book.
next prev parent reply other threads:[~2019-06-07 6:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 11:05 Toy computational "benchmark" in Ada (new blog post) David Trudgett
2019-06-06 17:48 ` Olivier Henley
2019-06-06 23:14 ` David Trudgett
2019-06-06 23:27 ` Paul Rubin
2019-06-07 5:24 ` David Trudgett
2019-06-07 5:36 ` Paul Rubin
2019-06-06 20:31 ` Jeffrey R. Carter
2019-06-06 23:02 ` David Trudgett
2019-06-07 0:13 ` Paul Rubin
2019-06-07 4:50 ` Paul Rubin
2019-06-07 5:41 ` David Trudgett
2019-06-07 6:00 ` Paul Rubin
2019-06-07 6:25 ` David Trudgett
2019-06-07 6:38 ` Paul Rubin [this message]
2019-06-07 5:28 ` David Trudgett
2019-06-07 5:57 ` Paul Rubin
2019-06-07 6:21 ` David Trudgett
2019-06-07 6:22 ` Paul Rubin
2019-06-07 6:29 ` David Trudgett
2019-06-07 6:42 ` Paul Rubin
2019-06-07 17:55 ` Jeffrey R. Carter
2019-06-08 11:00 ` David Trudgett
2019-06-07 1:42 ` johnscpg
2019-06-07 5:34 ` David Trudgett
2019-06-08 10:17 ` David Trudgett
2019-06-08 1:14 ` johnscpg
2019-06-08 10:56 ` David Trudgett
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox