comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada tasking question
Date: Wed, 18 Apr 2007 13:40:54 -0500
Date: 2007-04-18T13:40:54-05:00	[thread overview]
Message-ID: <f05okq$bt8$1@jacob-sparre.dk> (raw)
In-Reply-To: 20070418201307.18a85fd9@cube.tz.axivion.com

"Stefan Bellon" <sbellon@sbellon.de> wrote in message
news:20070418201307.18a85fd9@cube.tz.axivion.com...
...
> Therefore I have the idea of just starting N tasks in parallel (where N
> can be specified by the user e.g. according to the number of CPU cores
> of the machine) instead of tasks for all buckets at once.
>
> Starting N tasks, then waiting for them to get all finished and only
> then starting the next N tasks is not difficult. But how would I do it,
> so that there are always N tasks running (apart of course when
> everything has been processed) and that a new tasks is starting on the
> next bucket as soon as a task on a previous bucket has finished?
>
> Any ideas are very welcome!

I'd suggest organizing the tasks as workers and the buckets as jobs. The
idea is that each task is a loop that just gets a job (a bucket in your
case), processes it, sends the result, and gets another job, etc. You just
need a protected data structure to serve the jobs, and an array of worker
tasks, and then you can easy vary N to any value you want to try.

                          Randy.





  reply	other threads:[~2007-04-18 18:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 18:13 Ada tasking question Stefan Bellon
2007-04-18 18:40 ` Randy Brukardt [this message]
2007-04-18 20:12   ` Jeffrey R. Carter
2007-04-18 22:43     ` Stefan Bellon
2007-04-19  2:02       ` Steve
2007-04-18 21:08   ` Leif Holmgren
2007-04-18 22:57     ` Stefan Bellon
2007-04-18 23:41       ` Brian May
2007-04-19  0:25       ` Randy Brukardt
2007-04-19  8:02         ` Stefan Bellon
2007-04-19 12:47         ` Jacob Sparre Andersen
2007-04-19 16:11           ` Anh Vo
2007-04-20  4:32           ` Jeffrey R. Carter
2007-04-19  0:50       ` Jeffrey R. Carter
2007-04-18 19:50 ` Alex R. Mosteo
2007-04-18 23:00   ` Stefan Bellon
2007-04-19 20:37   ` Pascal Obry
2007-04-19  2:13 ` jimmaureenrogers
2007-04-19  7:49 ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
1996-10-18  0:00 whiting_ms@corning.com (Matt Whiting)
replies disabled

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