Every .NETcf app has 3 threads at startup? +1 @ minimise

D

Daniel Moth

Hi

Working with Process Viewer it seems that every .NETcf app has at least 3
threads at startup...

There is one thread which (looking at the Current PID column and matching it
with the PID in the process pane) is in the gwes process. I think I can
safely assume this is the main GUI thread...

Maybe we can assume that one of the other 2 threads is the GC thread that
wakes up on demand. Is this correct? If not then what does this second
thread do?

In any case what is the 3rd thread for?

To thicken the plot, if I minimise the form of the simple CF app an extra
(4th) thread is created(!) What is that for? Maybe this is the GC thread(?)

Cheers
Daniel
 
B

Brian Smith [MSFT]

#1 The main application thread.
#2 is used to control various period timers and timeouts that can be
scheduled by the system or applications.
#3 is used to track changes to the active TCP/IP interfaces (simulating the
media sense behavior that is present on Windows XP but not Windows CE).
The fourth thread you are seeing sometimes is probably the thread that is
used to run object Finalizers. It is created when the first finalizable
object is garbage collected.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Daniel Moth" <[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: Re: Every .NETcf app has 3 threads at startup? +1 @ minimise
| Date: Wed, 3 Sep 2003 10:47:32 +0100
| Lines: 79
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: dsl-217-155-140-110.zen.co.uk 217.155.140.110
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:32631
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi
|
| Thanks for your suggestion... If you mean running from VS then no I was
not
| running under the debugger... The 3 threads (+ 1 at minimise) appear for
any
| simple app I run on our CE 4.2 device... I verified that simple eVC apps
| show only 1 thread...
|
| Since then I noticed that desktop .NET apps also have 3 threads (and one
of
| them is at higher priority than the rest)...
|
| It is important to know what these threads are for various reasons... One
of
| them is to know how the app's behaviour will be affected if we up the
| priority of every other thread in the app... (the 3 mysterious threads run
| at normal priority)
|
| Cheers
| Daniel
|
|
| | > If you are running under the debugger then these are debugging threads.
| >
| > --------------------
| > -Suresh Venkatraman [msft]
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights
| > --------------------
| > | From: "Daniel Moth" <[email protected]>
| > | Subject: Every .NETcf app has 3 threads at startup? +1 @ minimise
| > | Date: Mon, 18 Aug 2003 18:17:56 +0100
| > | Lines: 23
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | NNTP-Posting-Host: 194.242.149.254
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:31211
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi
| > |
| > | Working with Process Viewer it seems that every .NETcf app has at
least
| 3
| > | threads at startup...
| > |
| > | There is one thread which (looking at the Current PID column and
| matching
| > it
| > | with the PID in the process pane) is in the gwes process. I think I
can
| > | safely assume this is the main GUI thread...
| > |
| > | Maybe we can assume that one of the other 2 threads is the GC thread
| that
| > | wakes up on demand. Is this correct? If not then what does this second
| > | thread do?
| > |
| > | In any case what is the 3rd thread for?
| > |
| > | To thicken the plot, if I minimise the form of the simple CF app an
| extra
| > | (4th) thread is created(!) What is that for? Maybe this is the GC
| > thread(?)
| > |
| > | Cheers
| > | Daniel
| > |
| > |
| > |
| > |
| >
| >
| >
|
|
|
 
D

Daniel Moth

Thanks for the reply.. good info..

Assuming I can't change the priority of #2 and #3 (I can for #1), it sounds
like a bad idea to up the priority of any thread in a .NET app that uses
timers and sockets.. If I am reading this wrong please let me know...

Cheers
Daniel


Brian Smith said:
#1 The main application thread.
#2 is used to control various period timers and timeouts that can be
scheduled by the system or applications.
#3 is used to track changes to the active TCP/IP interfaces (simulating the
media sense behavior that is present on Windows XP but not Windows CE).
The fourth thread you are seeing sometimes is probably the thread that is
used to run object Finalizers. It is created when the first finalizable
object is garbage collected.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Daniel Moth" <[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: Re: Every .NETcf app has 3 threads at startup? +1 @ minimise
| Date: Wed, 3 Sep 2003 10:47:32 +0100
| Lines: 79
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: dsl-217-155-140-110.zen.co.uk 217.155.140.110
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:32631
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi
|
| Thanks for your suggestion... If you mean running from VS then no I was
not
| running under the debugger... The 3 threads (+ 1 at minimise) appear for
any
| simple app I run on our CE 4.2 device... I verified that simple eVC apps
| show only 1 thread...
|
| Since then I noticed that desktop .NET apps also have 3 threads (and one
of
| them is at higher priority than the rest)...
|
| It is important to know what these threads are for various reasons... One
of
| them is to know how the app's behaviour will be affected if we up the
| priority of every other thread in the app... (the 3 mysterious threads run
| at normal priority)
|
| Cheers
| Daniel
|
|
| | > If you are running under the debugger then these are debugging threads.
| >
| > --------------------
| > -Suresh Venkatraman [msft]
| >
| > This posting is provided "AS IS" with no warranties, and confers no
rights
| > --------------------
| > | From: "Daniel Moth" <[email protected]>
| > | Subject: Every .NETcf app has 3 threads at startup? +1 @ minimise
| > | Date: Mon, 18 Aug 2003 18:17:56 +0100
| > | Lines: 23
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | NNTP-Posting-Host: 194.242.149.254
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:31211
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi
| > |
| > | Working with Process Viewer it seems that every .NETcf app has at
least
| 3
| > | threads at startup...
| > |
| > | There is one thread which (looking at the Current PID column and
| matching
| > it
| > | with the PID in the process pane) is in the gwes process. I think I
can
| > | safely assume this is the main GUI thread...
| > |
| > | Maybe we can assume that one of the other 2 threads is the GC thread
| that
| > | wakes up on demand. Is this correct? If not then what does this second
| > | thread do?
| > |
| > | In any case what is the 3rd thread for?
| > |
| > | To thicken the plot, if I minimise the form of the simple CF app an
| extra
| > | (4th) thread is created(!) What is that for? Maybe this is the GC
| > thread(?)
| > |
| > | Cheers
| > | Daniel
| > |
| > |
| > |
| > |
| >
| >
| >
|
|
|
 
B

Brian Smith [MSFT]

If you boost the priority of a thread, be sure that the high priority
thread yields the CPU frequently. For example, it would be fine to have a
high priority thread that ran briefly to process an incoming event but
spent most of its time blocked. Having your main application thread run
always with high priority would probably be a bad idea. Even if you don't
use timers and sockets, it would be a bad to continously starve the
finalizer thread of time because that would prevent finalizable objects
from getting freed-up completely.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Daniel Moth" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Every .NETcf app has 3 threads at startup? +1 @ minimise
| Date: Fri, 26 Sep 2003 15:04:05 +0100
| Lines: 138
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 194.242.149.254
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:34510
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Thanks for the reply.. good info..
|
| Assuming I can't change the priority of #2 and #3 (I can for #1), it
sounds
| like a bad idea to up the priority of any thread in a .NET app that uses
| timers and sockets.. If I am reading this wrong please let me know...
|
| Cheers
| Daniel
|
|
| | > #1 The main application thread.
| > #2 is used to control various period timers and timeouts that can be
| > scheduled by the system or applications.
| > #3 is used to track changes to the active TCP/IP interfaces (simulating
| the
| > media sense behavior that is present on Windows XP but not Windows CE).
| > The fourth thread you are seeing sometimes is probably the thread that
is
| > used to run object Finalizers. It is created when the first finalizable
| > object is garbage collected.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > --------------------
| > | From: "Daniel Moth" <[email protected]>
| > | References: <#[email protected]>
| > <[email protected]>
| > | Subject: Re: Every .NETcf app has 3 threads at startup? +1 @ minimise
| > | Date: Wed, 3 Sep 2003 10:47:32 +0100
| > | Lines: 79
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | NNTP-Posting-Host: dsl-217-155-140-110.zen.co.uk 217.155.140.110
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:32631
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi
| > |
| > | Thanks for your suggestion... If you mean running from VS then no I
was
| > not
| > | running under the debugger... The 3 threads (+ 1 at minimise) appear
for
| > any
| > | simple app I run on our CE 4.2 device... I verified that simple eVC
apps
| > | show only 1 thread...
| > |
| > | Since then I noticed that desktop .NET apps also have 3 threads (and
one
| > of
| > | them is at higher priority than the rest)...
| > |
| > | It is important to know what these threads are for various reasons...
| One
| > of
| > | them is to know how the app's behaviour will be affected if we up the
| > | priority of every other thread in the app... (the 3 mysterious threads
| run
| > | at normal priority)
| > |
| > | Cheers
| > | Daniel
| > |
| > |
| > | | > | > If you are running under the debugger then these are debugging
| threads.
| > | >
| > | > --------------------
| > | > -Suresh Venkatraman [msft]
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights
| > | > --------------------
| > | > | From: "Daniel Moth" <[email protected]>
| > | > | Subject: Every .NETcf app has 3 threads at startup? +1 @ minimise
| > | > | Date: Mon, 18 Aug 2003 18:17:56 +0100
| > | > | Lines: 23
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <#[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | NNTP-Posting-Host: 194.242.149.254
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:31211
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi
| > | > |
| > | > | Working with Process Viewer it seems that every .NETcf app has at
| > least
| > | 3
| > | > | threads at startup...
| > | > |
| > | > | There is one thread which (looking at the Current PID column and
| > | matching
| > | > it
| > | > | with the PID in the process pane) is in the gwes process. I think
I
| > can
| > | > | safely assume this is the main GUI thread...
| > | > |
| > | > | Maybe we can assume that one of the other 2 threads is the GC
thread
| > | that
| > | > | wakes up on demand. Is this correct? If not then what does this
| second
| > | > | thread do?
| > | > |
| > | > | In any case what is the 3rd thread for?
| > | > |
| > | > | To thicken the plot, if I minimise the form of the simple CF app
an
| > | extra
| > | > | (4th) thread is created(!) What is that for? Maybe this is the GC
| > | > thread(?)
| > | > |
| > | > | Cheers
| > | > | Daniel
| > | > |
| > | > |
| > | > |
| > | > |
| > | >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|
|
 
D

Daniel Moth

Thnx again...

Brian Smith said:
If you boost the priority of a thread, be sure that the high priority
thread yields the CPU frequently. For example, it would be fine to have a
high priority thread that ran briefly to process an incoming event but
spent most of its time blocked. Having your main application thread run
always with high priority would probably be a bad idea. Even if you don't
use timers and sockets, it would be a bad to continously starve the
finalizer thread of time because that would prevent finalizable objects
from getting freed-up completely.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Daniel Moth" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Every .NETcf app has 3 threads at startup? +1 @ minimise
| Date: Fri, 26 Sep 2003 15:04:05 +0100
| Lines: 138
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 194.242.149.254
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:34510
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Thanks for the reply.. good info..
|
| Assuming I can't change the priority of #2 and #3 (I can for #1), it
sounds
| like a bad idea to up the priority of any thread in a .NET app that uses
| timers and sockets.. If I am reading this wrong please let me know...
|
| Cheers
| Daniel
|
|
| | > #1 The main application thread.
| > #2 is used to control various period timers and timeouts that can be
| > scheduled by the system or applications.
| > #3 is used to track changes to the active TCP/IP interfaces (simulating
| the
| > media sense behavior that is present on Windows XP but not Windows CE).
| > The fourth thread you are seeing sometimes is probably the thread that
is
| > used to run object Finalizers. It is created when the first finalizable
| > object is garbage collected.
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > --------------------
| > | From: "Daniel Moth" <[email protected]>
| > | References: <#[email protected]>
| > <[email protected]>
| > | Subject: Re: Every .NETcf app has 3 threads at startup? +1 @ minimise
| > | Date: Wed, 3 Sep 2003 10:47:32 +0100
| > | Lines: 79
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | NNTP-Posting-Host: dsl-217-155-140-110.zen.co.uk 217.155.140.110
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:32631
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | Hi
| > |
| > | Thanks for your suggestion... If you mean running from VS then no I
was
| > not
| > | running under the debugger... The 3 threads (+ 1 at minimise) appear
for
| > any
| > | simple app I run on our CE 4.2 device... I verified that simple eVC
apps
| > | show only 1 thread...
| > |
| > | Since then I noticed that desktop .NET apps also have 3 threads (and
one
| > of
| > | them is at higher priority than the rest)...
| > |
| > | It is important to know what these threads are for various reasons...
| One
| > of
| > | them is to know how the app's behaviour will be affected if we up the
| > | priority of every other thread in the app... (the 3 mysterious threads
| run
| > | at normal priority)
| > |
| > | Cheers
| > | Daniel
| > |
| > |
| > | | > | > If you are running under the debugger then these are debugging
| threads.
| > | >
| > | > --------------------
| > | > -Suresh Venkatraman [msft]
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > rights
| > | > --------------------
| > | > | From: "Daniel Moth" <[email protected]>
| > | > | Subject: Every .NETcf app has 3 threads at startup? +1 @ minimise
| > | > | Date: Mon, 18 Aug 2003 18:17:56 +0100
| > | > | Lines: 23
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <#[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | > | NNTP-Posting-Host: 194.242.149.254
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl
| > | > microsoft.public.dotnet.framework.compactframework:31211
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > | > |
| > | > | Hi
| > | > |
| > | > | Working with Process Viewer it seems that every .NETcf app has at
| > least
| > | 3
| > | > | threads at startup...
| > | > |
| > | > | There is one thread which (looking at the Current PID column and
| > | matching
| > | > it
| > | > | with the PID in the process pane) is in the gwes process. I think
I
| > can
| > | > | safely assume this is the main GUI thread...
| > | > |
| > | > | Maybe we can assume that one of the other 2 threads is the GC
thread
| > | that
| > | > | wakes up on demand. Is this correct? If not then what does this
| second
| > | > | thread do?
| > | > |
| > | > | In any case what is the 3rd thread for?
| > | > |
| > | > | To thicken the plot, if I minimise the form of the simple CF app
an
| > | extra
| > | > | (4th) thread is created(!) What is that for? Maybe this is the GC
| > | > thread(?)
| > | > |
| > | > | Cheers
| > | > | Daniel
| > | > |
| > | > |
| > | > |
| > | > |
| > | >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top