Messages in this thread |  | | Date | Fri, 1 Sep 2000 13:21:21 +0200 (CEST) | From | Marco Colombo <> | Subject | Re: SCO: "thread creation is about a thousand times faster than on |
| |
On Thu, 31 Aug 2000, Erik McKee wrote:
> Hello! > > This is one of my first posts here, so try to be gentle, please ;) > > Seems like if a thread which shares a VM with all the other threads of the > same family does an execve, the following would be likely to occurr, using > the standard definition of execve. The vm would be overwriteen with the > new image, but this would have to wwipe out all the other threads in the > process, 'cuz otherwise everything they refer to has just been overwritten > by the results of the execve. However, if the execve'ing thread was > allowed to spawn off intop a new address space before the execve, it would > then become a new process, and leave the parent procvess with one less > thread to worry about.
I think that's close to Linus' idea. But it reminds me more a fork()+exec() rather than a simple exec().
OK. I'm clueless C programmer. I write:
program A: pid = getpid(); /* imagine is 300 */ ... exec("program B");
program B: ... pid = getpid(); /* I'm expecting 300 */
Then I modify A:
program A2: pid = getpid(); /* 400 */ if (!fork()) { exec("program B); } ...
program B: ... pid = getpid(); /* I'm expecting != 400 */
This is ok because that's what I asked for. Suppose I make a MT version of A. It would behave just like A2. The thread who's performing the exec() becomes a different process and program B sees a different pid.
It's like saying: an exec() in a MT process behaves like a fork()+exec() sequence in a normal process.
I'm not really against it... it's just a little weird. Killing all threads, and doing a "real" exec(), leads to the expected semantic. Of course, since you should expect the "defined" semantic, that matter is about choosing the definition. B-)
BTW, I don't think it needs to be a kernel matter. exec() in a MT program can be defined to kill all threads in userland before doing the exec().
> > Or am I being very stupid and overlooking something critical here?
Do you consider the above problem "critical"? B-)
> > Have a nice day ;) > Erik McKee > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > Please read the FAQ at http://www.tux.org/lkml/ >
.TM. -- ____/ ____/ / / / / Marco Colombo ___/ ___ / / Technical Manager / / / ESI s.r.l. _____/ _____/ _/ Colombo@ESI.it
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |