0

I'm thinking of developing my own work-stealing scheduler, and one of the issues that needs to be solved is the possibility of stack overflows. These occur only on infrequent cases where one worker continuously steals tasks from the others e.g.:

steal();
work();
steal();
work();
steal();
...

Several techniques can be used to avoid this pattern, however simply increasing stack space is probably the best option as it allows for other optimizations. On single threaded applications this can be done with a call to setrlimit() but with multiple threads it has no effect (unless called from the main thread).

This behavior is possibly related to stacks having a fixed size across multiple threads. However with split-stacks (implemented on GCC 4.6.0+) this restriction is no longer true.

My question is whether the call to setrlimit() simply works with split-stacks, or in the negative case if one can call the underlying brk()/mmap()/sbrk() and do it manually.

João Rafael
  • 131
  • 1
  • 7

1 Answers1

0

In a hackish way, I guess I could use pthread_attr_setstacksize()/pthread_create()/pthread_join() to create a new thread and do all the the work inside it, this however as the unnecessary overhead of thread creation/scheduling.

João Rafael
  • 131
  • 1
  • 7