Making Linux safe for pthreads
Posted Aug 15, 2002 6:13 UTC (Thu) by
IkeTo (subscriber, #2122)
Parent article:
Making Linux safe for pthreads
I might be mistaken, but I really think that all the work cannot make it affordable to create, say, 1000 threads by a single process. My worry is that a thread is not cheap to the kernel at all. Each thread requires its own task_struct, which means one page of memory. To create 1000 threads in a program, it means 4M space will be needed for holding these task_struct's. And these pages are in the kernel, i.e., they cannot be put into the swap space even if all the 1000 threads are sleeping. The old wisdom is that to support many threads, one need user-mode threads that maps to threads within the kernel, which is not what provided by the pthread library. Of course, the kernel patches improves the efficiency of thread creation and destruction. But does it mean that creating 1000 kernel threads in a process is no longer a really broken behaviour?
(
Log in to post comments)