Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 May 2004 21:14:58 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        Tim Robbins <tjr@freebsd.org>
Cc:        threads@freebsd.org
Subject:   Re: execve() and KSE
Message-ID:  <Pine.BSF.4.21.0405192113200.11004-100000@InterJet.elischer.org>
In-Reply-To: <20040520015754.GA2572@cat.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help
What is supposed to happen is that all the execve should stall awaiting
all the other kernel threads to abort/suicide and then it should proceed
with the execve as per normal.
it is possible this doesn't work right.. I haven't tried ti for a LONG
time..

julian

On Thu, 20 May 2004, Tim Robbins wrote:

> What is supposed to happen when a threaded process (linked with libpthread)
> calls execve()?
> 
> The program attached to this message seems to execute "true" correctly, but
> it never returns to the shell I invoked it from. ^T shows it in the state
> "running", and the system load average approaches 1.00:
> 
> load: 0.15  cmd: true 726 [running] 0.00u 0.00s 0% 200k
> load: 0.56  cmd: true 726 [running] 0.00u 0.00s 0% 200k
> load: 0.91  cmd: true 726 [running] 0.00u 0.00s 0% 200k
> 
> However, it's not using any CPU according to %CPU:
> 
> $ ps -Haxo pid,%cpu,mwchan,state,command -p 726
>   PID %CPU MWCHAN STAT COMMAND
>   726  0.0 -      RL+  true
> 
> The system is FreeBSD 5.2-CURRENT/amd64 with a kernel from May 9, and with
> WITNESS and INVARIANTS both turned off. I'll try updating and re-enabling
> the diagnostic options later today.
> 
> Here's the code in question:
> 
> #include <pthread.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> static pthread_cond_t cond;
> 
> void *
> thrstart(void *a)
> {
> 
> 	pthread_cond_wait(&cond, NULL);
> 	if (execl("/usr/bin/true", "true", NULL) < 0)
> 		perror("execl");
> 	return (NULL);
> }
> 
> int
> main(int argc, char *argv[])
> {
> 	void *v;
> 	pthread_t t1;
> 
> 	pthread_cond_init(&cond, NULL);
> 	pthread_create(&t1, NULL, thrstart, NULL);
> 	pthread_cond_broadcast(&cond);
> 	pthread_join(t1, &v);
> 
> 	exit(0);
> }
> _______________________________________________
> freebsd-threads@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org"
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0405192113200.11004-100000>