Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"11-30-11 - Basic sketch of Worker Thread system with dependencies"

4 Comments -

1 – 4 of 4
Blogger Miroslav said...

Text does not show how nr-task can end in rtr-queue so it might be obvious. The question is: Can one particular nr-task get stuck if it will regularly go through pop from nr-queue front and immediately push to its back?

December 3, 2011 at 4:08 AM

Blogger cbloom said...

"Text does not show how nr-task can end in rtr-queue so it might be obvious."

It doesn't, it stays in NR queue until its deps are done, at which point it will get executed at spot (*2)

"The question is: Can one particular nr-task get stuck if it will regularly go through pop from nr-queue front and immediately push to its back?"

Sort of; it shouldn't get stuck, eventually its deps will be done and it will be run and not re-pushed. You are correct however that as written I was popping off the front of a FIFO and putting on the back, which is not ideal.

I'm adding an addendum to the post about that with code mark (*4)

December 3, 2011 at 10:41 AM

Blogger cbloom said...

Another point about that :

"The question is: Can one particular nr-task get stuck if it will regularly go through pop from nr-queue front and immediately push to its back?"

If you care about being "realtime" ; that is, if you want the FIFO to really be "fair" , there is an issue :

say you have some NR item and you push it.

then somebody just floods the system with submissions to the RTR queue.

Depending on how you implement your sem OR , you could never execute the NR item until all the RTR's are done.

This might be bad if you care about latency from submission to completion.

In particular if your semaphore OR wait does something like

if sem1.try_wait return
if sem2.try_wait return

then you prefer sem1 and will keep popping it until it is empty.

One simple way to fix this is to alternate or randomize the preference in the OR wait.

December 3, 2011 at 10:44 AM

Blogger Drawknob said...

Re: tasks with dependencies. Have you loooked at phasers? www.cs.rice.edu/~vs3/PDF/Shirako-Sarkar-IPDPS-2010.pdf

December 6, 2011 at 11:30 PM

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.