Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"02-18-09 - Perfectionists are Good Bosses"

2 Comments -

1 – 2 of 2
Blogger MaciejS said...

Actually, the main thread shouldn't just sit there waiting for event (signalizing that workers are done) either. If possible, it should participate in performing tasks as well (fetching them from central queue/stealing from workers - depends on the system), if it has nothing better to do anyway.

February 19, 2009 at 12:40 AM

Blogger cbloom said...

Yeah, though I think that could only hurt in my system. I think the ideal setup for me is to make a worker per core, and then also have the "main thread" which can run along and keep doing user code or whatever. So if the main thread does work there it will only cause cache contention with a worker.

However there are certainly cases where having the main thread participate could be a big win. One is if the cores are not fully committed. But another is if one of the workers is asleep or idle, you'd rather let the main thread go ahead and take over his slot so that you can just do work without the thread switch penalty.

Another case is if the main thread blocks on a small work item, it's better to just find it and immediately execute it on the main thread rather than wait for a worker to do it.

February 19, 2009 at 8:33 AM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.