PC Review


Reply
Thread Tools Rate Thread

AutoResetEvents a limited resource?

 
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      31st Jan 2005
Hi All,

In reading the documentation on AutoResetEvents and WaitHandle I'm not sure
whether they are limited resources (i.e. limited by something other than
memory). WaitHandle mentions that it uses some nebulous "operating system
resources" and I would like to know more specifically is happening under the
hood. Is it safe to allocate hundreds of thousands of these things?

--Ben
 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      1st Feb 2005
Hi Ben,

An event is considered an operating system resource. Yes, 'physically' it
involves only the memory, but the system keeps a count of allocated
handles - you can see it on the "Perfomance" tab of the Task Manager.
My understanding is the possible number of events to be created depends
totally on the amount of virtual memory available, but still Windows might
maintain some additional tables for housekeeping and this can impose
additional restrictions on the possible number of existing events. At the
moment I am writing this post there is 14960 open handles - this includes
events, mutexes, probably open files and modules, and so on.

Still, why would you need so many events created?

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Ben" <(E-Mail Removed)> wrote in message
news:EF88BAFB-BDAE-4D94-9D3C-(E-Mail Removed)...
> Hi All,
>
> In reading the documentation on AutoResetEvents and WaitHandle I'm not
> sure
> whether they are limited resources (i.e. limited by something other than
> memory). WaitHandle mentions that it uses some nebulous "operating system
> resources" and I would like to know more specifically is happening under
> the
> hood. Is it safe to allocate hundreds of thousands of these things?
>
> --Ben


 
Reply With Quote
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      1st Feb 2005
I am writing a distributed server application that has a central component
that knows about all connected users (but does not actually host the sessions
itself - it is just a lookup mechanism). That central component needs to
ensure that different components cannot modify the session state at the same
time. I don't want that central component to have to understand all
operations that can happen on a session so I can't use a simple monitor/lock
statement on the central component itself and make the change locally.

I want to be able to lock each user's session independently from a remote
component . A remote component will request the lock, block until timeout or
lock is achieved, make the change to the session, then release the lock.
However, there will be several hundred thousand simultaneous users. So I
want to understand how heavyweight the AutoResetEvents are as I was
considering using them for my blocking mechanism.

--Ben

"Dmitriy Lapshin [C# / .NET MVP]" wrote:

> Hi Ben,
>
> An event is considered an operating system resource. Yes, 'physically' it
> involves only the memory, but the system keeps a count of allocated
> handles - you can see it on the "Perfomance" tab of the Task Manager.
> My understanding is the possible number of events to be created depends
> totally on the amount of virtual memory available, but still Windows might
> maintain some additional tables for housekeeping and this can impose
> additional restrictions on the possible number of existing events. At the
> moment I am writing this post there is 14960 open handles - this includes
> events, mutexes, probably open files and modules, and so on.
>
> Still, why would you need so many events created?
>
> --
> Sincerely,
> Dmitriy Lapshin [C# / .NET MVP]
> Bring the power of unit testing to the VS .NET IDE today!
> http://www.x-unity.net/teststudio.aspx
>
> "Ben" <(E-Mail Removed)> wrote in message
> news:EF88BAFB-BDAE-4D94-9D3C-(E-Mail Removed)...
> > Hi All,
> >
> > In reading the documentation on AutoResetEvents and WaitHandle I'm not
> > sure
> > whether they are limited resources (i.e. limited by something other than
> > memory). WaitHandle mentions that it uses some nebulous "operating system
> > resources" and I would like to know more specifically is happening under
> > the
> > hood. Is it safe to allocate hundreds of thousands of these things?
> >
> > --Ben

>
>

 
Reply With Quote
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      4th Feb 2005
I think you can conduct an experiment, creating events one afer another and
testing what is the maximum number possible. I assume you have a very
powerful hardware since you are going to support several hundred thousand
simultaneous users, so I generally think there should be enough RAM
available to allocate all the events.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Ben" <(E-Mail Removed)> wrote in message
news1AD58A4-3359-43FF-B77D-(E-Mail Removed)...
>I am writing a distributed server application that has a central component
> that knows about all connected users (but does not actually host the
> sessions
> itself - it is just a lookup mechanism). That central component needs to
> ensure that different components cannot modify the session state at the
> same
> time. I don't want that central component to have to understand all
> operations that can happen on a session so I can't use a simple
> monitor/lock
> statement on the central component itself and make the change locally.
>
> I want to be able to lock each user's session independently from a remote
> component . A remote component will request the lock, block until timeout
> or
> lock is achieved, make the change to the session, then release the lock.
> However, there will be several hundred thousand simultaneous users. So I
> want to understand how heavyweight the AutoResetEvents are as I was
> considering using them for my blocking mechanism.
>
> --Ben
>
> "Dmitriy Lapshin [C# / .NET MVP]" wrote:
>
>> Hi Ben,
>>
>> An event is considered an operating system resource. Yes, 'physically' it
>> involves only the memory, but the system keeps a count of allocated
>> handles - you can see it on the "Perfomance" tab of the Task Manager.
>> My understanding is the possible number of events to be created depends
>> totally on the amount of virtual memory available, but still Windows
>> might
>> maintain some additional tables for housekeeping and this can impose
>> additional restrictions on the possible number of existing events. At the
>> moment I am writing this post there is 14960 open handles - this includes
>> events, mutexes, probably open files and modules, and so on.
>>
>> Still, why would you need so many events created?
>>
>> --
>> Sincerely,
>> Dmitriy Lapshin [C# / .NET MVP]
>> Bring the power of unit testing to the VS .NET IDE today!
>> http://www.x-unity.net/teststudio.aspx
>>
>> "Ben" <(E-Mail Removed)> wrote in message
>> news:EF88BAFB-BDAE-4D94-9D3C-(E-Mail Removed)...
>> > Hi All,
>> >
>> > In reading the documentation on AutoResetEvents and WaitHandle I'm not
>> > sure
>> > whether they are limited resources (i.e. limited by something other
>> > than
>> > memory). WaitHandle mentions that it uses some nebulous "operating
>> > system
>> > resources" and I would like to know more specifically is happening
>> > under
>> > the
>> > hood. Is it safe to allocate hundreds of thousands of these things?
>> >
>> > --Ben

>>
>>


 
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
VS2005 Resource Editor - How to make new line from string resource? Peter Hartlén Microsoft C# .NET 9 21st Jul 2008 08:41 AM
Resource String showing Empty. Is the number of Strings in the Resources limited? JB Microsoft VB .NET 2 21st Aug 2007 09:53 PM
Failed to load resource from resource file. Plese check up your setup Andry Microsoft Dot NET Framework 0 22nd Nov 2005 07:52 AM
System.ArgumentException: [Resource lookup failed - infinite recursion detected. Resource name: Argument_AddingDuplicate__] Roz Lee Microsoft Dot NET 0 4th Feb 2005 01:57 AM
can I call getString() to get a string from a separate resource file instead of embedded resource? babylon Microsoft Dot NET Framework 2 7th Oct 2003 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:46 AM.