When we use lock/monitor for concurrency management it just allows 1 thread to pass at a time. Using semaphore and SemaphoreSlim we can allow more than 1 thread to pass from the lock area. SemaphoreSlim is more light weight and used for request coming from within the process while Semaphore is for request coming from external process.
See the following video on concurrent generic collections in c#: -
Click to get c# interview questions and answers
Get more Most asked c# interview questions from author’s blog
write a comment