Quote:
Originally Posted by
matrixmadhan
Does the word ' implementation ' means the library ?
It means the code that performs the functions, it
implements the functions.
Quote:
Originally Posted by
matrixmadhan
Or is the scheduling that is taken care by the kernel ?
Yes.
Kernel Threads - the code that implements these runs in the kernel, only the kernel has the ability to do the synchronisation (eg see SMP etc).
User theads - the user process does the synchronisation because the kernel knows nothing about them, there is nobody else.
For instance "Xavier Leroy's LinuxThreads" uses Linux's "clone()" call to make a kernel task that shares the same memory as the current process, so the library provides the API, but the actual thread is a fully fledged kernel task, the kernel does the scheduling and synchronisation.
GNU's portable threads on the other hand uses signals, setjmp/longjmp, contexts or other sleight of hand in order to create a new stack and execution environment in the same process, as the kernel knows nothing about these, all the scheduling and thread switch has to be done by similar sleight of hand setjmp/longjmp, etc.
So which mechanism can take advantage of multiple CPUs and put different threads on different CPUs?