[clug] threads v processes
Hugh Fisher
hugh.fisher at anu.edu.au
Thu Sep 6 17:08:20 MDT 2012
On 06/09/12 19:40, steve jenkin wrote:
> I was reading a paper by Rob Pike and he mentions:
>
> - Processes need to lock shared memory because they *can* execute in
> parallel (simultaneously)
>
> - threads within a single process don't ever execute simultaneously.
>
>
> Does anyone know if this is right with Linux on multi-core processors??
Not since NPTL which became standard with one of the 2.6 kernels.
Linux POSIX threads are now implemented with the clone syscall, so to
the kernel they're just another task_struct and can be scheduled on any
available CPU.
POSIX defines SCOPE_PROCESS (which Rob Pike is referring to) and
SCOPE_SYSTEM (Linux NPTL, partly inspired by IRIX sprocs) but doesn't
require an implementation to support both. Hope you're not asking
because you have to port code from a different Unix that had the
opposite behaviour.
--
cheers,
Hugh Fisher
More information about the linux
mailing list