Your worker fn is too quickly executed: more time is spent managing queues (and that require some synchronization) than executing actions. If your worker fn was more realistic (more computationally heavy) I tjink you'll see 4 cores humming at 100%.
(You wrote "atom" several times but I guess you meant "agent".) On Tue, Oct 6, 2009 at 7:48 PM, MarkSwanson <mark.swanson...@gmail.com>wrote: > > Good catch. I had forgotten that. > > I did some more tests with 4 queues and found that there seemed to be > some contention going on that prevented all cores from being utilized > fully. > With the example provided 2 cores will pin at 100% (excellent). With 4 > atoms and one test fn one core will stay around 20%, no other core > > 70%. > When I used 4 separate worker fns along with 4 separate atoms things > improved and all 4 cores pinned at around 60%. It would be interesting > to know why having 4 separate fns makes a difference (STM?). > > Wrt 60%: I simply think this was an artifact of my test. If I had > spawned another thread to feed another atom I'm sure I could have > easily pegged all CPUs to 100%. > > > > > -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---