I created some code in the kernel that loops until some condition becomes true,
i.e.
while(!condition) { //do nothing}
Now, in userspace, I created a bunch of threads using pthreads, some of which
will change that condition to be true (by making a system call that will change
its value in the kernel). However, when I run this code, my entire computer
freezes up and continues to loop to infinity.
This does not fit my understanding of how userspace->kernel threads and the
scheduler works (I am using 2.6.28 kernel). I was under the impression that
when I created a userspace thread using pthreads, the kernel would implicitly
create a kernel thread for each of these. Now, the scheduler will eventually
context switch out the kernel thread when its time quanta runs out, so there
should never be the possibility for this loop to sit on the CPU forever and not
allow anything else to run.
What part of my reasoning above is flawed?