Thanks for simplifying this in easier manner. I have got doubt, will be glad you can answer it. Suppose we have three "writing thread" writing a message into a message queue and one "reading thread" which needs to read the message from the queue. So in this case to synchronize the process we can either go ahead with "Binary Semaphore", which will allow only one thread to read or write at a time or using mutex by locking the resource. Now the question is which method should be preferred and why? (in context with RTOS in embedded systems) Thanks in advance :)
Thank you Dr.Shriram for the very simple and crystal clear presentation on differences between semaphores and mutex. I look forward to your presentation on oneAPI Hands-on Workshop- Let us SYCL. Thank you
Hi Shriram - Nice and very clear video describing the concept of mutex vs. spin locks vs semaphores. I have couple of follow up question/requests 1. Can semaphore, mutex, spin locks work across the processors? For example, if the mutex used by two threads running two different CPUs, will it work? 2. What is the underlying assembly instructions for spin locks? You can take type processor, like ARM.
Thank you so much for clear explanation. I have one question: In you last point, you told: - When more than one resources available: use Semaphore (that should be counting semaphore). - When only one resource available: use Mutex. Can we not use binary semaphore instead of mutex? Why mutex is preferred over binary semaphore?
Process and thread word used interchangeably here. Mutex and semaphore used for synchronizing threads in a process. Mutex and semaphore not available across multiple process.
You have explained it so clearly! I have one question if semaphore and mutex are different then in book “Operating System Concepts” there’s a Bounded buffer problem. In that they have taken three semaphores. And one semaphore is “semaphore mutex = 1” how’s that possible? Can you/anyone explain?? Please.
Whether one or more resources we can always use semaphore only rite ? because binary semaphore works good for one resource and counting semaphores works good when there are many resources. Why we have to use mutex and get confused when semaphore works for both ?
sir, can we use semaphore for both thread and process? or can we use mutex for both thread and process? means is there any rule that semaphore should be use with process or mutex should be use with thread?
If we have one shared resource...we can use binary semaphore also instead of mutex...can you tell me where is the exact usage of these semaphore and mutex !?
So just tell the MUTEX Is a kind of BINARY Semaphore that’s it , that’s all I needed to know , this subject is so dramatic 😂😂 BTW thanks a lot for this video , loved this