Which Class Limits The Number Of Threads That Can Access A Resource Or Pool Of Resources Concurrently?
-
Semaphore
-
Monitor
-
SynchronizationContext
-
TimeOut
A
Correct answer
Explanation
A Semaphore (specifically a counting semaphore) is designed to limit the number of threads that can access a resource concurrently. You initialize it with a maximum count, and each thread acquires it (decrementing count) on entry and releases it (incrementing count) on exit. When count reaches zero, additional threads block until others release. Monitors provide mutual exclusion but don't limit concurrent access to a specific number. SynchronizationContext is for marshaling calls to a specific context. Timeout is not a synchronization class.