Re: Threading Delay
- From: "Jimmy" <jim_klos@xxxxxxxx>
- Date: Tue, 5 Apr 2005 10:09:57 -0700
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.
>
>
>
.
- Follow-Ups:
- Re: Threading Delay
- From: Rob Smitter
- Re: Threading Delay
- References:
- Threading Delay
- From: Rob Smitter
- Threading Delay
- Prev by Date: Threading Delay
- Next by Date: Re: Threading Delay
- Previous by thread: Threading Delay
- Next by thread: Re: Threading Delay
- Index(es):
Relevant Pages
|