workqueue in user space
Based on multi-thread in user space. You can put your function into ump, so the function is running parallelly. Thus, you can take advantage of multi-core CPUs.
- without ump
The result of test is "delay is 47921"
- with ump
The result of test is "delay is 9799"
- result
The performance is improved by 389%
gcc -fpic -shared -o libump.so ump.c
gcc main.c -L. -lump -lpthread
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./a.out
./a.out 1