Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'debugger': 0.09; 'subject:process': 0.09; 'threads,': 0.09; 'threads.': 0.09; 'thread': 0.11; 'carefully.': 0.16; 'debugger,': 0.16; 'merely': 0.16; 'thread.': 0.16; 'threads': 0.16; 'wrote:': 0.17; 'creates': 0.18; 'equivalent': 0.20; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'starts': 0.29; '"the': 0.29; "i'm": 0.29; 'usually': 0.30; 'subject: ?': 0.30; 'running': 0.32; 'to:addr:python-list': 0.33; 'done': 0.34; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'fact': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'more': 0.63; 'sit': 0.65; 'received:74.208': 0.71; 'difference.': 0.84; 'received:74.208.4.194': 0.84; 'single,': 0.84 Date: Wed, 06 Feb 2013 09:59:15 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: each process only has one main thread ,right ? References: <51124411$0$29991$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <51124411$0$29991$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:y2I+7UqmIjgJsvpELXZmudKYw6GyLNh3bRIJJttGLYo aaGTqj09jOeSqNn3f9FFDbFYA534Nb4clGhhCSEZkZNjMGGT0n AJD2+QLW2J7FhP8/zrOrW+9EdxIUN/Ru1IQy4FfxKlBL16+Ssw JhdySaxgP9LTJXci2XX9ED0xYlWYT127NfZ30ZieKs84Y4tYnq nKjDx9Q7bQlv7X6P1zkCQTU3jOzcD4AomvsLLFdO2JjEK/ufTc 5cP6yr4q8X50IMsgvTvNGLLwMZAeaZ9Kh3SKOTwI2G9E4ofRMi mnEbkMUMS/dNpsqkz9/RKtRP3MND2SZuA0KDLwn5pi9J22e+w= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360162775 news.xs4all.nl 6881 [2001:888:2000:d::a6]:35598 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38281 On 02/06/2013 06:52 AM, Steven D'Aprano wrote: > iMath wrote: > >> 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 ? > > 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. > > 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