Thousands of mutexes?
Peter Chapin wrote: > I’m considering a program design that would involve, potentially, a large > number of mutexes. In particular, there could be thousands of mutexes > “active” at any one time. Will this cause a problem for my hosting > operating system or are all the resources associated with a mutex in my > application’s address space? For example, in the case of pthreads, are > there any resources associated with a mutex other than those in the > pthread_mutex_t object? Is the answer any different for Win32 using > CRITICAL_SECTION objects? (I know that there are system and process limits > on the number of mutexes that can be created under OS/2… last I knew it > was in the 64K range). POSIX mutexes are usually user space objects, so the limit is purely based on your virtual memory quotas. Usually, they’re fairly small. Some obscure hardware may require a mutex to live in special memory areas, in which case there’d be a system quota — but that’s not relevent on any modern “main