PC Review


Reply
Thread Tools Rate Thread

Garbage Collection - Impact on other processes

 
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      29th Jun 2006
Hello,

Our application will have a few managed and unmanaged processes running at
all times. What happens to the managed and unmanaged processes when the
garbage collector runs? Are they all suspended until garbage collection
completes or only the managed processes?

 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      29th Jun 2006
The GC only suspends the threads of the collecting app. All other apps,
managed or unmanaged, are untouched.


--
Chris Tacke
OpenNETCF Consulting
www.opennetcf.com
--



"Joe" <(E-Mail Removed)> wrote in message
news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
> Hello,
>
> Our application will have a few managed and unmanaged processes running at
> all times. What happens to the managed and unmanaged processes when the
> garbage collector runs? Are they all suspended until garbage collection
> completes or only the managed processes?
>



 
Reply With Quote
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      29th Jun 2006
Thank you. I just wanted to clarify your statement that "The GC only
suspends the threads of the collecting app".

Does this mean that the garbage collector only suspends the application
whose memory is currently being collected? If six garbage collected
processes are running, then would each of the six be briefly suspended while
their own memory was garbage collected? Does this mean that at any given
time during garbage collection, that only 1 process will be suspended and the
other five will be running normally?

"<ctacke/>" wrote:

> The GC only suspends the threads of the collecting app. All other apps,
> managed or unmanaged, are untouched.
>
>
> --
> Chris Tacke
> OpenNETCF Consulting
> www.opennetcf.com
> --
>
>
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
> > Hello,
> >
> > Our application will have a few managed and unmanaged processes running at
> > all times. What happens to the managed and unmanaged processes when the
> > garbage collector runs? Are they all suspended until garbage collection
> > completes or only the managed processes?
> >

>
>
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      29th Jun 2006
Each managed app has it's own GC instance. So when an app requests an
allocation that in turn requires collection, the GC suspends all threads in
that process. All other processes, whether managed or unmanaged, are
completely unaffected.

Of course if a collection is occuring, it's likely that resources are low,
so other apps are going to be more likely to collect at that point as well,
and if it's collecting becasue of a WM_HIBERNATE message, then you know that
it was a broadcast to all applications and all managed apps will BE
collecting at that point. So while the GC of each process isn't inherently
linked, since collection is tied to available resources, and resources are
shared among all processes, it's quite possible for events to occur that
would lead to multiple processes to be collecting at the same time.

-Chris




"Joe" <(E-Mail Removed)> wrote in message
news:2E85DBB2-095E-46DF-9124-(E-Mail Removed)...
> Thank you. I just wanted to clarify your statement that "The GC only
> suspends the threads of the collecting app".
>
> Does this mean that the garbage collector only suspends the application
> whose memory is currently being collected? If six garbage collected
> processes are running, then would each of the six be briefly suspended
> while
> their own memory was garbage collected? Does this mean that at any given
> time during garbage collection, that only 1 process will be suspended and
> the
> other five will be running normally?
>
> "<ctacke/>" wrote:
>
>> The GC only suspends the threads of the collecting app. All other apps,
>> managed or unmanaged, are untouched.
>>
>>
>> --
>> Chris Tacke
>> OpenNETCF Consulting
>> www.opennetcf.com
>> --
>>
>>
>>
>> "Joe" <(E-Mail Removed)> wrote in message
>> news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
>> > Hello,
>> >
>> > Our application will have a few managed and unmanaged processes running
>> > at
>> > all times. What happens to the managed and unmanaged processes when
>> > the
>> > garbage collector runs? Are they all suspended until garbage collection
>> > completes or only the managed processes?
>> >

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      29th Jun 2006
Thanks again for your helpful replies.

To follow up on your last reply, if the GC starts executing for a given
managed
process can it be interrupted by another higher priority thread in another
process?

"<ctacke/>" wrote:

> Each managed app has it's own GC instance. So when an app requests an
> allocation that in turn requires collection, the GC suspends all threads in
> that process. All other processes, whether managed or unmanaged, are
> completely unaffected.
>
> Of course if a collection is occuring, it's likely that resources are low,
> so other apps are going to be more likely to collect at that point as well,
> and if it's collecting becasue of a WM_HIBERNATE message, then you know that
> it was a broadcast to all applications and all managed apps will BE
> collecting at that point. So while the GC of each process isn't inherently
> linked, since collection is tied to available resources, and resources are
> shared among all processes, it's quite possible for events to occur that
> would lead to multiple processes to be collecting at the same time.
>
> -Chris
>
>
>
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:2E85DBB2-095E-46DF-9124-(E-Mail Removed)...
> > Thank you. I just wanted to clarify your statement that "The GC only
> > suspends the threads of the collecting app".
> >
> > Does this mean that the garbage collector only suspends the application
> > whose memory is currently being collected? If six garbage collected
> > processes are running, then would each of the six be briefly suspended
> > while
> > their own memory was garbage collected? Does this mean that at any given
> > time during garbage collection, that only 1 process will be suspended and
> > the
> > other five will be running normally?
> >
> > "<ctacke/>" wrote:
> >
> >> The GC only suspends the threads of the collecting app. All other apps,
> >> managed or unmanaged, are untouched.
> >>
> >>
> >> --
> >> Chris Tacke
> >> OpenNETCF Consulting
> >> www.opennetcf.com
> >> --
> >>
> >>
> >>
> >> "Joe" <(E-Mail Removed)> wrote in message
> >> news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
> >> > Hello,
> >> >
> >> > Our application will have a few managed and unmanaged processes running
> >> > at
> >> > all times. What happens to the managed and unmanaged processes when
> >> > the
> >> > garbage collector runs? Are they all suspended until garbage collection
> >> > completes or only the managed processes?
> >> >
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      29th Jun 2006
You want to know if the GC can be interrupted?

The thread under which the GC runs is a thread like any other thread running
in the system. It follows the same rules for priority and quantum in place
for the entire system. So the scheduler will run the thread for it's life
or the quantum period, whichever is smaller, at which point it will then
switch to run another task. If a higher-priority item comes in, then the
scheduler will stop execution of the lower priority thread and migrate to
the higher one

IIRC when the GC runs it increases the priority of the thread it's running
on, but only a couple points at most, so it's still down around 250 or 251.
I'm not certain on this point, but I think I saw that behavior in testing.

-Chris





"Joe" <(E-Mail Removed)> wrote in message
news:7758670B-5844-4298-BECF-(E-Mail Removed)...
> Thanks again for your helpful replies.
>
> To follow up on your last reply, if the GC starts executing for a given
> managed
> process can it be interrupted by another higher priority thread in another
> process?
>
> "<ctacke/>" wrote:
>
>> Each managed app has it's own GC instance. So when an app requests an
>> allocation that in turn requires collection, the GC suspends all threads
>> in
>> that process. All other processes, whether managed or unmanaged, are
>> completely unaffected.
>>
>> Of course if a collection is occuring, it's likely that resources are
>> low,
>> so other apps are going to be more likely to collect at that point as
>> well,
>> and if it's collecting becasue of a WM_HIBERNATE message, then you know
>> that
>> it was a broadcast to all applications and all managed apps will BE
>> collecting at that point. So while the GC of each process isn't
>> inherently
>> linked, since collection is tied to available resources, and resources
>> are
>> shared among all processes, it's quite possible for events to occur that
>> would lead to multiple processes to be collecting at the same time.
>>
>> -Chris
>>
>>
>>
>>
>> "Joe" <(E-Mail Removed)> wrote in message
>> news:2E85DBB2-095E-46DF-9124-(E-Mail Removed)...
>> > Thank you. I just wanted to clarify your statement that "The GC only
>> > suspends the threads of the collecting app".
>> >
>> > Does this mean that the garbage collector only suspends the application
>> > whose memory is currently being collected? If six garbage collected
>> > processes are running, then would each of the six be briefly suspended
>> > while
>> > their own memory was garbage collected? Does this mean that at any
>> > given
>> > time during garbage collection, that only 1 process will be suspended
>> > and
>> > the
>> > other five will be running normally?
>> >
>> > "<ctacke/>" wrote:
>> >
>> >> The GC only suspends the threads of the collecting app. All other
>> >> apps,
>> >> managed or unmanaged, are untouched.
>> >>
>> >>
>> >> --
>> >> Chris Tacke
>> >> OpenNETCF Consulting
>> >> www.opennetcf.com
>> >> --
>> >>
>> >>
>> >>
>> >> "Joe" <(E-Mail Removed)> wrote in message
>> >> news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
>> >> > Hello,
>> >> >
>> >> > Our application will have a few managed and unmanaged processes
>> >> > running
>> >> > at
>> >> > all times. What happens to the managed and unmanaged processes when
>> >> > the
>> >> > garbage collector runs? Are they all suspended until garbage
>> >> > collection
>> >> > completes or only the managed processes?
>> >> >
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
Sachin Palewar
Guest
Posts: n/a
 
      30th Jun 2006
Joe I attended a very good session on CF memory management internals,
where Gaurav talked about GC at length. You can download PPT from his
session at:

http://www.wintoolzone.com/Presentations.aspx

It may be of some help :-)

Regards,

Sachin Palewar

Palewar Techno Solutions
Pocket PC & Mobile Software Development
Nagpur, India

http://www.palewar.com



<ctacke/> wrote:
> You want to know if the GC can be interrupted?
>
> The thread under which the GC runs is a thread like any other thread running
> in the system. It follows the same rules for priority and quantum in place
> for the entire system. So the scheduler will run the thread for it's life
> or the quantum period, whichever is smaller, at which point it will then
> switch to run another task. If a higher-priority item comes in, then the
> scheduler will stop execution of the lower priority thread and migrate to
> the higher one
>
> IIRC when the GC runs it increases the priority of the thread it's running
> on, but only a couple points at most, so it's still down around 250 or 251.
> I'm not certain on this point, but I think I saw that behavior in testing.
>
> -Chris
>
>
>
>
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:7758670B-5844-4298-BECF-(E-Mail Removed)...
> > Thanks again for your helpful replies.
> >
> > To follow up on your last reply, if the GC starts executing for a given
> > managed
> > process can it be interrupted by another higher priority thread in another
> > process?
> >
> > "<ctacke/>" wrote:
> >
> >> Each managed app has it's own GC instance. So when an app requests an
> >> allocation that in turn requires collection, the GC suspends all threads
> >> in
> >> that process. All other processes, whether managed or unmanaged, are
> >> completely unaffected.
> >>
> >> Of course if a collection is occuring, it's likely that resources are
> >> low,
> >> so other apps are going to be more likely to collect at that point as
> >> well,
> >> and if it's collecting becasue of a WM_HIBERNATE message, then you know
> >> that
> >> it was a broadcast to all applications and all managed apps will BE
> >> collecting at that point. So while the GC of each process isn't
> >> inherently
> >> linked, since collection is tied to available resources, and resources
> >> are
> >> shared among all processes, it's quite possible for events to occur that
> >> would lead to multiple processes to be collecting at the same time.
> >>
> >> -Chris
> >>
> >>
> >>
> >>
> >> "Joe" <(E-Mail Removed)> wrote in message
> >> news:2E85DBB2-095E-46DF-9124-(E-Mail Removed)...
> >> > Thank you. I just wanted to clarify your statement that "The GC only
> >> > suspends the threads of the collecting app".
> >> >
> >> > Does this mean that the garbage collector only suspends the application
> >> > whose memory is currently being collected? If six garbage collected
> >> > processes are running, then would each of the six be briefly suspended
> >> > while
> >> > their own memory was garbage collected? Does this mean that at any
> >> > given
> >> > time during garbage collection, that only 1 process will be suspended
> >> > and
> >> > the
> >> > other five will be running normally?
> >> >
> >> > "<ctacke/>" wrote:
> >> >
> >> >> The GC only suspends the threads of the collecting app. All other
> >> >> apps,
> >> >> managed or unmanaged, are untouched.
> >> >>
> >> >>
> >> >> --
> >> >> Chris Tacke
> >> >> OpenNETCF Consulting
> >> >> www.opennetcf.com
> >> >> --
> >> >>
> >> >>
> >> >>
> >> >> "Joe" <(E-Mail Removed)> wrote in message
> >> >> news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
> >> >> > Hello,
> >> >> >
> >> >> > Our application will have a few managed and unmanaged processes
> >> >> > running
> >> >> > at
> >> >> > all times. What happens to the managed and unmanaged processes when
> >> >> > the
> >> >> > garbage collector runs? Are they all suspended until garbage
> >> >> > collection
> >> >> > completes or only the managed processes?
> >> >> >
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>


 
Reply With Quote
 
Guest
Posts: n/a
 
      30th Jun 2006
Yes, in fact I'm the one who wrote that presentation and presented it
originally at MEDC US.

-Chris



"Sachin Palewar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Joe I attended a very good session on CF memory management internals,
> where Gaurav talked about GC at length. You can download PPT from his
> session at:
>
> http://www.wintoolzone.com/Presentations.aspx
>
> It may be of some help :-)
>
> Regards,
>
> Sachin Palewar
>
> Palewar Techno Solutions
> Pocket PC & Mobile Software Development
> Nagpur, India
>
> http://www.palewar.com
>
>
>
> <ctacke/> wrote:
>> You want to know if the GC can be interrupted?
>>
>> The thread under which the GC runs is a thread like any other thread
>> running
>> in the system. It follows the same rules for priority and quantum in
>> place
>> for the entire system. So the scheduler will run the thread for it's
>> life
>> or the quantum period, whichever is smaller, at which point it will then
>> switch to run another task. If a higher-priority item comes in, then the
>> scheduler will stop execution of the lower priority thread and migrate to
>> the higher one
>>
>> IIRC when the GC runs it increases the priority of the thread it's
>> running
>> on, but only a couple points at most, so it's still down around 250 or
>> 251.
>> I'm not certain on this point, but I think I saw that behavior in
>> testing.
>>
>> -Chris
>>
>>
>>
>>
>>
>> "Joe" <(E-Mail Removed)> wrote in message
>> news:7758670B-5844-4298-BECF-(E-Mail Removed)...
>> > Thanks again for your helpful replies.
>> >
>> > To follow up on your last reply, if the GC starts executing for a given
>> > managed
>> > process can it be interrupted by another higher priority thread in
>> > another
>> > process?
>> >
>> > "<ctacke/>" wrote:
>> >
>> >> Each managed app has it's own GC instance. So when an app requests an
>> >> allocation that in turn requires collection, the GC suspends all
>> >> threads
>> >> in
>> >> that process. All other processes, whether managed or unmanaged, are
>> >> completely unaffected.
>> >>
>> >> Of course if a collection is occuring, it's likely that resources are
>> >> low,
>> >> so other apps are going to be more likely to collect at that point as
>> >> well,
>> >> and if it's collecting becasue of a WM_HIBERNATE message, then you
>> >> know
>> >> that
>> >> it was a broadcast to all applications and all managed apps will BE
>> >> collecting at that point. So while the GC of each process isn't
>> >> inherently
>> >> linked, since collection is tied to available resources, and resources
>> >> are
>> >> shared among all processes, it's quite possible for events to occur
>> >> that
>> >> would lead to multiple processes to be collecting at the same time.
>> >>
>> >> -Chris
>> >>
>> >>
>> >>
>> >>
>> >> "Joe" <(E-Mail Removed)> wrote in message
>> >> news:2E85DBB2-095E-46DF-9124-(E-Mail Removed)...
>> >> > Thank you. I just wanted to clarify your statement that "The GC
>> >> > only
>> >> > suspends the threads of the collecting app".
>> >> >
>> >> > Does this mean that the garbage collector only suspends the
>> >> > application
>> >> > whose memory is currently being collected? If six garbage collected
>> >> > processes are running, then would each of the six be briefly
>> >> > suspended
>> >> > while
>> >> > their own memory was garbage collected? Does this mean that at any
>> >> > given
>> >> > time during garbage collection, that only 1 process will be
>> >> > suspended
>> >> > and
>> >> > the
>> >> > other five will be running normally?
>> >> >
>> >> > "<ctacke/>" wrote:
>> >> >
>> >> >> The GC only suspends the threads of the collecting app. All other
>> >> >> apps,
>> >> >> managed or unmanaged, are untouched.
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Chris Tacke
>> >> >> OpenNETCF Consulting
>> >> >> www.opennetcf.com
>> >> >> --
>> >> >>
>> >> >>
>> >> >>
>> >> >> "Joe" <(E-Mail Removed)> wrote in message
>> >> >> news:80BA4975-0E06-4879-8935-(E-Mail Removed)...
>> >> >> > Hello,
>> >> >> >
>> >> >> > Our application will have a few managed and unmanaged processes
>> >> >> > running
>> >> >> > at
>> >> >> > all times. What happens to the managed and unmanaged processes
>> >> >> > when
>> >> >> > the
>> >> >> > garbage collector runs? Are they all suspended until garbage
>> >> >> > collection
>> >> >> > completes or only the managed processes?
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
About Garbage Collection venkat rajesh Microsoft C# .NET 1 5th Dec 2008 08:13 AM
Garbage Collection bug? Anderas Broman Microsoft Dot NET Compact Framework 5 4th May 2004 12:51 AM
Garbage Collection C# Learner Microsoft C# .NET 2 15th Mar 2004 06:53 PM
Garbage collection Ralph Microsoft Windows 2000 Active Directory 5 12th Sep 2003 10:06 PM
Garbage Collection Sharon Microsoft ADO .NET 4 26th Jul 2003 12:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 PM.