(1) In a multi-threaded process,If one thread is busy on I/O will the entire process be blocked?
(2) Which is better to use a mutex or a binary semaphore ? When should I use a mutex and when should I use a binary Semaphore ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1). Well, at a time only one thread is allocated the CPU in multithreaded application. If you are saying that your thread is regularly busy with I/O, then practically it can happen that all other threads keep waiting in queue to get CPU allocated to them. It depends upon the CPU
allocation algorithmused. Like if thread are usingTime-Sharingalgorithm, then of course on completion of time, current thread will be send to the back of the queue.2). Check out this post: – Difference between binary semaphore and mutex