|
|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Thu, 11 Jan 2007
Userspace threading and theirs benefits and drawbacks.
Benefits.
1. Fast scheduling.
There is no need to cross userspace/kernelspace boundary to schedule
new thread execution (just watch what happens with userspace network stack
compared to kernel's one when there are a lot of syscalls performed
for small packets receiving/sending).
2. Fast thread creation and destruction.
It just becomes an allocation of the structure in the userspace,
no need for full creation process which is performed
in clone() syscall.
3. Smaller number of cache misses.
Since there is only one process instead of several threads,
cache locality is increased greatly with reduced number
of misses.
Drawbacks.
1. Scheduling fairness.
Since kernel does not know about multiple threads behind given process,
it can not add it appropriate number of timeslices for execution.
Can be solved either by more tight collaboarion of the userspace nad kernelspace
schedulers or simply by increasing process' nice value.
2. All communications are performed through one kevent pipe.
Which can be problematic (although interface was specially designed to be scalable).
3. Complex code for good SMP scalability and userspace scheduler.
I wanted to put it into 'Benefits' section, since that is exactly why I started
this project.
/devel/threading :: Link / Comments ()
|