Per què els pthreads no poden migrar en GNU/Linux?


Ohhh, Moshe Bar és… és… un ídol. Si a la presentació del projecte em pregunten perquè els pthreads no poden migrar respondré l’explicació que dóna aquest gran home. No té pèrdua.

PD: Sergi, sento si et desperto a aquestes hores ^_^’

Moshe wrote this answer about threading and openMosix to the mailing list.

From: Moshe Bar
Subject: pthreads and The Matrix
Date: 07 Aug 2002 06:30:56 +0200
HI Larry

Not being able to migrate pthreads is not an openMosix limitation but a
Linux one. Contrary to platforms like Solaris where threads are
light-weight processes with their own address space, threads in Linux do
not have their own memory address space. You can see the threads with ps
because each thread is a “task” for the Linux scheduler. However, that
task cannot live on its own, it needs the address space where it was
born. If we migrate the pthread to another machine, which address space
would it be connected to? I am sure you saw Matrix, and at one point
Neon asks what happends if somebody dies in the Matrix, if he would also
die in the real world. Trinity answered to him that a body (a pthread)
cannot live without a mind (ie memory, ie address space).

A great many things can be learned from Matrix.

But coming back to our subject here, once we have distributed shared
memory, we will be able to connect remote pthreads to their address
space back home. But that is still some time down the road. I guess
Matrix 2 will be out before we have distributed shared memory.