Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

each process only has one main thread ,right ?

20 views
Skip to first unread message

iMath

unread,
Feb 6, 2013, 6:23:29 AM2/6/13
to
When a program starts up, one thread begins running immediately. This is usually called the main thread of the program ,so each process only has one main thread ,right ?

Steven D'Aprano

unread,
Feb 6, 2013, 6:52:49 AM2/6/13
to
I'm not sure if we should say "each process HAS one main thread" or "each
process IS one main thread", or whether there is in fact a difference. But,
yes, each process is equivalent to a single thread.


--
Steven

Dave Angel

unread,
Feb 6, 2013, 9:59:15 AM2/6/13
to pytho...@python.org
Each process merely starts out as a single thread. If it creates other
threads, they are usually not considered main threads.

OP: But note that if a process is running under a debugger, or an IDE,
that debugger may inject one or more threads into the process.

The only place I now of where we care whether a particular thread in a
process is "the main thread" is with a gui, which usually can only sit
in a single, "main" thread. Any gui-related processing done in other
threads must be done very carefully.

--
DaveA

Cameron Simpson

unread,
Feb 6, 2013, 5:31:18 PM2/6/13
to Dave Angel, pytho...@python.org
On 06Feb2013 09:59, Dave Angel <d...@davea.name> wrote:
| The only place I now of where we care whether a particular thread in a
| process is "the main thread" is with a gui, which usually can only sit
| in a single, "main" thread. Any gui-related processing done in other
| threads must be done very carefully.

Single handlers run in the "main thread". So yes, we care if we're
multithreaded.
--
Cameron Simpson <c...@zip.com.au>

But I have to say, I "non-concur." (Non-concur was a term I learned at
IBM. IBM seemed to be a breeding ground for making up words and
phrases, turning verbs into nouns, etc. "Non-concur" seems to be for
those times when saying "I disagree" just isn't strong enough!)
- Robert D. Seidman <rob...@clark.net>
0 new messages