Performance comparison between "event" and "critical section" system objects

cpp Tunisia
  • 12 years ago

    Well, this is not a real question, it is just wondering.

    I recently studied in deep "event" and "critical section" system objects and found that "critical section" is nothing but an implementation on top of "event" object, so I wonder whether I should use "critical section" object or "event" object to solve programming tasks with better performances. In fact I have found that problems involving "critical section" objects can be solved using "event" (with some more code needed, just a little!) so why should Microsoft "invent" these?

    Another thing, the "CRITICAL_SECTION" structure has some fields that are never used or are just there for debugging purposes. But why should a released program have such debugging data? I know they may be useful for debugging, but removing them may reduce memory requirements of your program, especially if it uses heavily "critical section" objects (a server program, for example).

     Some guys say that in some cases "critical section" objects avoid the "user mode/kernel mode" transition, but when I studied that, it seemed to me that such things rarely occur in execution life time and it seems that it presents a risk of data corruption.

    If anyone is interested in this subject or anything else, he/she can contact me directly by email at "[email protected]" .

    Nice day! 

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”