views:

89

answers:

1

The Linux Kernel is said to be SMP. It is said that processes and kernel threads shall be distributed across processors.

  1. Does all Linux distribution like fedora13, ubuntu 10.04 Lucid by default enable SMP Linux?

  2. On an SMP Linux, which is better to follow- a) multi-process approach versus b) multi-threading approach

  3. Does pthread by default create a kernel level thread so that any application can take advantage of LWP as well as SMP?

If not, how can one make a kernel level thread using Pthreads. Any references would be much appreciated.

+5  A: 
  1. SMP has been in the kernel for years now. With most modern systems sporting at least two cores, it is almost always in use.
  2. Which to use depends much more on your problem space than on how many cores you have.
  3. Yes, Pthreads create kernel-level threads. (If you wanted user-space threads, you could use something like GNU Pth).
Marcelo Cantos
Hi Marcelo, Thanks for you reply! so when using pthreads, one thread can run in one core while another can run in another core?
Sashi
@Sashi: Yes. In fact, a single thread can be scheduled across multiple cores over its lifespan (not simultaneously, of course, but it can be switched from core to core, based on availability).
Marcelo Cantos
Thanks Marcelo!
Sashi