Re: Threading Delay



1) 512 threads is ridiculous, but you say "of varying sizes", and you see
this only occasionally, so it may be a low-resource situation... important
system tables being paged-out, then paged-in. Do you see the problem with a
reasonable number of threads, like 4?

2) Set up a dual-machine kernel-debugging situation with WinDbg, run your
app with 512 threads, and when you see the delay, break into debuggee
machine... the WinDbg help tells how to track down a cpu-hog. (Oh, you did
not mention that cpu utilization was 100%... well, if upper-management
approved this design, then it is a good reason to get another machine, if
only to show that it will not work!!)

3) Use Task Manager, display Page Faults Per Second -- if the problem is
that important system tables are being paged-out, this number should go up,
especially if the system is thrashing.

4) Use a profiler like VTune -- it might show where most of the time is
being spent.

5) I hope this 512-thread app is a research project or for
internal-use-only!!! If everyone wrote apps that used 512 threads... it's
the same thing as when everyone raises the priority of their processes!!!

"Rob Smitter" <rsmitter@xxxxxxxxxxxx> wrote in message
news:eo3jRhfOFHA.904@xxxxxxxxxxxxxxxxxxxxxxx
> I am confused about the action when threads terminate. I am having a
> problem where, on exit of a thread, the system seems to hang for variable
> amounts of time, from nothing noticeable to sometimes over a minute. In
> most cases it is not noticeable
>
> Some background:
>
> I have an app that builds up thread pool of varying sizes, up to 512
> threads. Each thread grabs it data from a queue. When the thread tries
to
> get the next item from the queue, if the queue is empty, the thread
> function exits. Each thread is started with beginthreadex. After the
> thread is terminated CloseHandle is called. From the documentation it
looks
> like there is no need to call _endthreadex as it is called when the
thread
> function terminates. The queue is filled up before the pool is started
>
> I have logged the exiting of the thread along with other thread activity
and
> from the log I can see the delay and it always shows up, if it shows up at
> all, when the thread exits.
>
> Is there a reason for this behavior? It also seems to happen more when
the
> thread pool is mostly shutdown. But not always. Sometimes it runs with
no
> delays. Is it related to the amount of the vitrtual memory used, actual
> memory used or ?
>
> Thanks for any hints to help me understand this.
>
>
>


.



Relevant Pages

  • Re: Opinion wanted
    ... the details including the nature of my own app (which you mischaraterized ... correct the current control (provided that control is invalid but invalid ... causes you to validate controls that have already been ... largely discreditted for good reason and has very little use these days. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: edit & continue
    ... > and just run the app in the dubugger to test it. ... there is little realistic way to perform unit tests, ... > solid reason, "If I encounter a simple mistake I can fix it without ... > practice talk that only seems to apply if you are following a certain ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Tablets? - OT
    ... - the main reason for porting was so idiots could maintain the code ... on a yellow legal pad. ... to find anyone to pay me to play with it. ... and an app that calculated the temperature from cricket chirps. ...
    (microsoft.public.vb.general.discussion)
  • Re: [PATCH/RFC] A method for clearing out page cache
    ... > app designers very frequently think that the VM gets its act wrong (most ... Any left over cache is wrong, ... coupled jobs. ... reason, perhaps this is such a reason. ...
    (Linux-Kernel)
  • Re: Why choose Kerio instead of ZA?
    ... Why would KPF2 have those open? ... > i/o is buffered, so it doesn't matter much anyway. ... but there must be some reason for it. ... It enables you to restart the app without rebooting on most ...
    (comp.security.firewalls)