[racket] Racket and concurrency

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Jul 4 13:08:21 EDT 2012

On Wed, Jul 4, 2012 at 11:36 AM, Harry Spier <vasishtha.spier at gmail.com> wrote:
> Firstly thanks also to Robby, Kevin and Rudiger for the detailed replies.
> Secondly:
>
> On Tue, Jul 3, 2012 at 1:56 PM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>
>> Assuming that you have multiple pages to process and that pages take
>> some non-trivial amount of time to process (seconds not milliseconds),
>> then making separate places to process pages seems like the right
>> starting point.
>>
>> If you find you want to get to some lower-level granularity (if you're
>> seeing too much work still at the page level (ie only 4 pages on an 8
>> core machine), then you can then use futures inside the places to
>> break things up on a per-line or per-section of the page granularity.
>
> Lets see if I understand you correctly:
> If I have 8 cores and I'm processing 8 pages by using 8 places (one
> per page processing function) then thats optimal.  But if I have an 8
> core machine but am processing 4 pages in parallel by using 4 places
> then I can utilize unused cores by using futures within the places.

Yes, that's what I was thinking.

Alternatively, if you know how to break a page up into lines
(cheaply), then you coudl also send your 4 pages to 8 places, each
getting 1/2 of a page.

It really depends on the details of how much work processing a page is
and how difficult it is to break that task up into multiple subtasks.

Robby


Posted on the users mailing list.