Re: To Context switch or Spin
- From: "Chris M. Thomasson" <no@xxxxxxxxxxxx>
- Date: Mon, 20 Oct 2008 20:26:17 -0700
"Paul" <spudWA@xxxxxxxxx> wrote in message news:4f7d5810-4fe2-4da6-8bdc-0d75c07e1082@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Oct 20, 3:05 pm, "Chris M. Thomasson" <n...@xxxxxxxxxxxx> wrote:
[...]
Thanks for the reply. There is alot of interesting information in it.
Unfortunately you don't have the same priorities as my boss. I'd love
to fix the problem properly but what they want is a quick and low
impact, easily tested fix for the final few months of the products
life.
Fun times!
;^(...
One more piece of information that I think is relevant to take into
consideration about my critical sections. They are as you would expect
wrapped in a class and expose a GetLock, ReleaseLock interface which
is used by a RAII class. The contract between the two is that when
GetLock() returns we have the lock, no ifs or buts. So in effect my
while (!TryEnterCriticalSection(cs))
Sleep(0); ; hope CS is unlocked next time I'm scheduled
is the same as below except // okay, no worries, we can do other
work. becomes okay do some work in another thread
if (! TryEnterCriticalSection(cs)) {
// okay, no worries, we can do other work.in another thread
} else {
// great! continue work in this thread
}
I'll certainly try to find out which threads/objects are causing my
locks and let you know
Am I being too pragmatic?
Well, I did not realize that your Boss was making those type of requirements. Okay. Well, If your main problem is too many file handles, which is what I get from reading your message... Then, well, the try-lock method is a 100% concrete solution because it will not create ANY handles on contention. The spin count adjustment solution might just work out for you, but its _not_ guaranteed. Humm... I need to think about this. Humm...
Off the top of my head, I would initially suggest setting the spin count to a high number like you already have experimented with. Since the app is going to die fairly soon, well, I guess it does not matter all that much.
Its a shame. But, life is life; fun times indeed!
:^/
.
- References:
- To Context switch or Spin
- From: spudWA@xxxxxxxxx
- Re: To Context switch or Spin
- From: Chris M. Thomasson
- Re: To Context switch or Spin
- From: Paul
- To Context switch or Spin
- Prev by Date: Re: To Context switch or Spin
- Next by Date: Re: To Context switch or Spin
- Previous by thread: Re: To Context switch or Spin
- Next by thread: Re: To Context switch or Spin
- Index(es):
Relevant Pages
|