lkml.org 
[lkml]   [2001]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [BUG 2.4.6] PPID of a process is set to itself
From
Date
Linus Torvalds <torvalds@transmeta.com> writes:

> if (!has_created_master_process) {
> new_me = clone(CLONE_VM | SIGCHLD);
> if (new_me > 0) {
> /* Original thread turns into master process */
> printf("I am the new master process, bow down before me!\n");
> has_created_master_process = 1;
> for (;;) {
> if (!waitpid(-1, NULL, 0))
> continue;
> if (errno == ENOCHLD)
> exit(0);
> .. we could do signal propagation here ..
> }
> }
> /* This child now takes over the role of the original thread */

A bit more complicated due to switching of stacks but that's basically
it. With this clone model using n+1 threads is the only way to get
the semantics right.

> Also, please do notice that one fundamental part of the CLONE_THREAD logic
> never made it into a stable kernel: the shared signal handling. So while
> CLONE_THREAD allows for many pthread-like things (one common process ID
> shared by all threads, for example), the most fundamental part of it was
> not actually merged into the standard kernel because of stability concerns
> in late pre-2.4 test cycle.

Exactly. This is holding off everything. The way this is solved
(basically: the limitations imposed on the userland implementation)
will determine much of the implementation.

I've done already a great deal of the implementation when Linus first
put the code in the late 2.3 kernels. If somebody finally would get
the signal handling stuff done (and a few more little things, some
Linus already agreed on) we could have a compliant pthread
implementation soon.

--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.053 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site