Number of CriticalSections

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?

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

and on OS X & Linux?

Same as win32: don’t worry about it.