This is a conceptual question.
According to this post, pthread is actually implemented using the clone() system call. So we can infer that there is a kernel thread (or a light-weight process) backing up a pthread in the user space. The kernel is aware of the pthread and can schedule it like a process.
As for kthread, according to Robert Love, kthreads are also created with the clone() system call:
clone(CLONE_VM| CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0)
So pthread and kthread both use clone() call. My first question is:
- Is there a difference between these two kinds of threads?
To answer my own question, I read on:
The significant difference between kernel threads and normal processes is that kernel threads do not have an address space (in fact, their mm pointer is NULL).
Is this one difference? I mean, a thread created by pthread_create() shares the address space with the normal process. In contrast, a kthread does not have its own address space. Is that correct?
What else is different?