Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion InitializeCriticalSectionAndSp inCount
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Neill Clift [MS]  
View profile  
 More options Jan 9 2002, 1:30 pm
Newsgroups: microsoft.public.win32.programmer.kernel
From: "Neill Clift [MS]" <nei...@microsoft.com>
Date: Wed, 9 Jan 2002 10:28:24 -0800
Local: Wed, Jan 9 2002 1:28 pm
Subject: Re: InitializeCriticalSectionAndSpinCount
I am trying to get the best tradeoff here I can. It was really
impossible to handle exceptions generated by
EnterCriticalSection and LeaveCriticalSection because
they left the CS in a state you couldn't recover from.
This forced apps that wanted to be robust into using
preallocation. We really want all apps to be robust so
removing the raise was my top priority. I was left with a large
number of internal apps using this flag and the associated memory
usage did have an effect on the memory footprint. I therefore decided
to ignore this flag. My reasoning is that any app getting the global
object is getting it because its under memory pressure. Performance
will be poor in this case anyway. I want to be robust in preference to
performance in this out of memory case. I chose to ignore the flag
because it helps a great deal with memory footprint. There is of course
a one time penalty when we allocate the event but its not a great deal
of time in comparison to waiting anyway. I don't really believe the
difference between just waiting and allocating an event and waiting is
significant.
Neill.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Daniel Lohmann" <dan...@uni-koblenz.de> wrote in message

news:8ato3uo3uav0k3ksiiqhab41ejp3hcoi5b@4ax.com...
> On Fri, 4 Jan 2002 16:16:52 -0800, "Neill Clift [MS]"
> <nei...@microsoft.com> wrote:

> >The idea behind setting the upper bit of the spin count is
> >to solve a somewhat thorny problem. Critcal sections in
> >contention create the events on demand. If the event
> >creates fail (lack of available memory etc) then these
> >API's would raise exceptions (both the Enter and Leave
> >functions). Starting in Windows XP we no longer raise
> >exceptions in the out of memory cases (For Enter and
> >Leave, Initialize still does) and so applications wanting
> >to be robust in this environment don't have to set this
> >bit. The critical section code falls back to a global
> >object in reduced memory situations (when event allocation
> >fails). For Windows XP this bit is ignored as a result.
> >Neill.

> However, this has also the drawback of getting things still more
> indetermined. I used the upper bit mostly not because I'm afraid of
> exceptions, but to know that I have an upper limit of time used to
> perform the EnterCriticalSection() call by not having to create the
> event object in EnterCriticalSeciton().  And if it could happen in XP
> that there is silently used a single global object, this is getting
> even worse :-(

> (I know that NT is not a hard realtime system. However, it  is
> behaving quite well in soft realtime tasks, especially on SMP
> systems.)

> Daniel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.