[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-code
Subject:    [osol-code] process/thread/lwp termination
From:       Mladen Nikitovic <mladen () imit ! kth ! se>
Date:       2008-01-25 2:51:19
Message-ID: 4440930.1201258341221.JavaMail.Twebapp () oss-app1
[Download RAW message or body]

Hi,

Just want to confirm the correctness of an observation I've made.

I have executed a multithreaded application with varying number of threads and I'm \
curious about the process termination part.

I'm running on a system with 4 processors so I have executed the application with 1, \
2, 3, and 4 threads to see the pattern.

When running with 1 single thread I can see:
1 call to proc_create, 1 call to thread_create, and 1 call to lwp_create, 

regarding termination I see 1 call to proc_exit and 1 call to thread_exit, but no \
call to lwp_exit, which means that it might be kept in the system by the kernel.

when running 2 threads, a similar scenario occurs:

1 proc_create, 2 thread_create, 2 lwp_create, 

termination: 1 proc_exit, 1 thread_exit, 1 lwp_exit (thus 1 less than number of \
threads)

3 threads:

1 proc_create, 3 thread_create, 3 lwp_create

termination:  1 proc_exit, 1 thread_exit, 2 lwp_exit

4 threads:

1 proc_create, 4 thread_create, 4 lwp_create

termination 1 proc_exit, 1 thread_exit, 3 lwp_exit

So to summarize:

The pattern seem to be the following:

1 process is created and terminated. Regardless of how many threads are created \
(NUMTHREADS), there is only 1 thread that is terminated (the first?). Finally, the \
number of terminated LWPs seem to be NUMTHREADS -1 (the lwp created last seem to be \
the choice here).

This is the pattern I have seen from my executions and I have tried to verify this by \
looking in the Solaris Internals book, chapter 2.9 - process termination. The process \
exit function pseudocode indicates that "all but 1 LWP's should be terminated", which \
confirms my NUMTHREADS -1 observation, but I can't see something that verifies that \
only 1 thread is terminated, regardless of how many have been created. Should I see \
it as a 1:1 mapping between the process termination and the termination of the first \
thread and that the other (child threads) have joined with the first thread before \
termination, which means that they are "virtually" terminated as well? Or are the \
still lurking in the system as the remaining LWP?

Regards,
Mladen
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic