Number of CriticalSections


#1

In my app, I need to lock r/w access to image files, and it may well be that there are 100.000 image files. Each image file would have its own CriticalSection that is locked before read or write. Is this architecture ok, or is there some limit of CriticalSection objects imposed by the OS? Also, it might be that my approach uses too much resources?


#2

on Windows a CriticalSection is not a system resource its just a handful of bytes, and some special CPU instructions to spin and wait.

Now Event objects or named Mutex thats a different story.

You can have unlimited CriticalSections


#3

and on OS X & Linux?


#4

Same as win32: don’t worry about it.