[Swift-user] meaning of foreach.max.threads

Michael Wilde wilde at mcs.anl.gov
Mon Aug 1 14:01:10 CDT 2011


----- Original Message -----
> From: "Lorenzo Pesce" <lpesce at uchicago.edu>
> To: swift-user at ci.uchicago.edu
> Sent: Monday, August 1, 2011 1:52:52 PM
> Subject: [Swift-user] meaning of foreach.max.threads
> foreach.max.threads. When I read the explanation I left somewhat
> perplexed.
> 
> 
> Do you mean threads in the sense of shared memory parallel processes
> here (then 1024 is very large number to me) or something else?

This number refers to Karajan threads - much lighter weight than Java threads. Karajan multiplexes its concurrent operations into a much smaller number of real Java threads.

Its best to think of this property as just setting the maximum number of concurrent iterations that any foreach loop will be allowed to execute in parallel.

> Do you really mean saving memory, or I am not understand it?

Yes - this throttle is there to put a controllable bound on the amount of memory Swift uses in processing concurrent foreach loops.  The higher the throttle, the more loop bodies Swift will run in parallel, and the objects required for those executions consume memory.  So if a foreach loop had 1M elements to process, the throttle would only allow 1K of these to run at any given time.

- Mike




More information about the Swift-user mailing list