I want to implement POSIX compatible microflows in a Linux environment. The basic idea is as follows:
- Using the technique described here , assign a new stack space for each fiber.
- Using setitimer, create a timer that will send signals at a constant time interval. The signal handler for this timer will act as a scheduler and switch between fibers.
The problem is that running longjmp in the signal handler will not end the handler, so the kernel will wait for it to finish, instead, to deliver new signals. This makes context switching impossible because there are no signals to start the switches. One solution would be to unlock SIGALRM, so many signals can be executed by the handler at the same time, but this will cause problems with race conditions.
What is the best and easiest way to implement proactive microflows? All the examples I found on Google were not proactive.
source
share