Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > each process only has one main thread ,right ?

Reply
Thread Tools

each process only has one main thread ,right ?

 
 
iMath
Guest
Posts: n/a
 
      02-06-2013
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 ?
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      02-06-2013
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.


--
Steven

 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      02-06-2013
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: each process only has one main thread ,right ? Cameron Simpson Python 0 02-06-2013 10:31 PM
FAQ 6.14 How do I process each word on each line? PerlFAQ Server Perl Misc 0 04-08-2011 04:00 AM
FAQ 6.14 How do I process each word on each line? PerlFAQ Server Perl Misc 0 01-26-2011 11:00 PM
Change main window href from IE search panel, after user has left my main page? Robert Oschler Javascript 1 10-12-2004 08:34 PM



Advertisments