Microsoft Interview Question
Country: -
I think you have the right idea but not sure the code is right. It looks like you never actually release your mutex until the nth thread arrives. Probably should release right after incrementing your count. Unless you can't guarantee there won't be more than n threads, in which case you should release m in your else block as well.
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
there are so many gr8 of kind articles over there
http : // michkashala.blogspot.com
really helpfully
thanks a lot keep posting
Use two semaphores. One as a mutex and other as a semaphore and keep a count of waiting semaphores.
- Ashish Kaila December 04, 2011