Difference between Binary Semaphores and Mutexes

preview_player
Показать описание
Source code can be found here:

===== Support us through our store =====

===== Check out our website =====

===== Check out our Discord server =====
Рекомендации по теме
Комментарии
Автор

Your explanation is so GREAT!
Thank You & we will absolutely wait for new things to learn from you.

hzhpdjk
Автор

Your explanation is really good and clear with code examples. Thank you so much!

wangstboss
Автор

Concepts detail description are nice 🙂

animeshkumarsinha
Автор

Today I understood clearly with practical example.Thank you...

narasarajv
Автор

Thank you so much for this video. It was very knowledgable.

nikhilagrawal
Автор

Brilliant explanation with illustration

i_am_wiz
Автор

Thank you for this video It cleared diff between Binary semaphore and Mutex

tukaramgaikwad
Автор

Undefined behavior almost cost me my OS HW thank god for resubmission

mikmik
Автор

It's been along time hope you are doig ok teacher 😇

temmmbebkd
Автор

A very very thank you for this informative video

utkarshtripathi
Автор

Great
Please do tutorials on GLib
If possible suggest

bhrt
Автор

Hey mate where have you been the last months. I wanted to thank you you videos are the best for c intermediate level learning plus i was wondering if you are planning on doing some socket programming in c for linux

Somali-ivpu
Автор

Hi,
I have tried in my lab to unlock a mutex in a different thread and it was working completely fine for me.
But when I create a mutex with type as PTHREAD_MUTEX_ERRORCHECK, unlocking in different thread throws error in return code.
Now my question,
1. How unlocking a normal(default init ) mutex in different thread works fine for me. Any possible reasons ?
I tried with while (1) loop to lock in in thread and unlock in another thread for 2 hrs and did not see any issue in it.

johnduraisinghy
Автор

Semaphore maintains a queue for all those threads that tried to enter the critical section when the semaphore variable is 0. So every thread gets a chance in the end in a fair manner (FIFO). While mutex doesn't provide such functionality, and randomly wakeup the thread. Is my statement correct?

chetan
Автор

could you make at least one video with an exercise where you combine the use of semaphores and mutexes? In my classes they tend to put problems like that in exams >_<

natiiim
Автор

QQ: First thread enters the routine1 and then takes the lock. Now unless this thread calls unlock on this lock, how can any other thread enter the critical section(as another thread has the lock and in the critical section)?? But, in your case I see a lot of 'Current value is:.." printed in the console. Am I missing something here?
Guess: Is even this is a part of undefined behaviour?

backendengineering
Автор

When the semaphore value is initialised to 0 and a thread called sem_post() thrice, then the value of the semaphore becomes 3? When initialised to 0, should it be called as binary semaphore or counting semaphore?

chetan
Автор

for some reason my mutex code is not breaking? don't know if this has to do with the new M1 mac ARM chips or not

dhruvshah
Автор

in case the semaphore value is greater than 1 and multiple threads are executing the critical section will it lead to a race condition?

shamanthhebbar
Автор

but how you lock one thread function and then the other function can be executed if the first lock is not already unlocked?

tripiper
welcome to shbcf.ru