Synchronization 1: Semaphores

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024
  • This video presents the first of several synchronization tools: semaphores. Semaphores (specifically, counting semaphores) allow processes to send signals and request access to resources. When a resource is not available, the process waits until a signal is received. Based on content from the book Operating Systems: Internals and Design Principles, by William Stallings.

Комментарии • 47

  • @lokinasthenerd
    @lokinasthenerd 2 года назад +1

    I have spent the past two weeks struggling to understand how semaphores work for a uni course I'm taking, and you have explained it more clearly in a little over 15 minutes than my course material and teacher could in those two weeks! Thank you so gd much!!

  • @t3ntube357
    @t3ntube357 3 года назад

    because of you I now unnderstand symaphore, thanks jacob

  • @defneumut9197
    @defneumut9197 5 лет назад +6

    whoa! what an explanation, pure, simple... loved it

  • @sirleo5103
    @sirleo5103 4 года назад +6

    For the semsignal, shouldn't it be "If s >= 0" instead of "If s

  • @Roogie22
    @Roogie22 5 лет назад +3

    this channel with x2 speed is life

  • @Marcos-pf6rx
    @Marcos-pf6rx 4 года назад +1

    Thanks! Greetings from Argentina.

  • @SuperSam4y0u
    @SuperSam4y0u 4 года назад +1

    Explained in a simple way 😊 the semaphore count could be the number of database connections we have in pool or other similar limited resource. I am just thinking the logic to decrement, check if negative and if yes then block the process must all be done as a atomic operation yes?

  • @wolfram77
    @wolfram77 4 года назад

    OS has to do a lot of work if critical section does not complete. Is there a way for a process to signal that it is executing a critical section?

  • @durumarthu
    @durumarthu Год назад

    Wait! Isn't sem_post() or what you call semSignal() require the semaphore value (s) to be >= 0 to be able to signal (wake) any waiting (sleeping) process or thread? If so, how could you have s=-3 and sill be able to wake (signal) processes that are in the waiting queue?

  • @cb-sy5qu
    @cb-sy5qu 7 лет назад +34

    bounced on my boy's Semaphore to this for hours

  • @anaibrahim4361
    @anaibrahim4361 4 года назад +1

    before i finish your explanation i want to thank you for it
    i finally arrived to understand all the bla bla bla in the univ and other channels about semaphores

  • @s1mpl3us34
    @s1mpl3us34 2 года назад

    We implements a counting semaphore where multiple threads can call sem_wait
    and sem_post concurrently.
    In addition to the integer value N associated with the Semaphore, the semaphore includes a
    waiting list that keeps track of the waiting threads and a mutex lock that protects the shared data
    inside the semaphore instance. If two thread gets access to the semi_wait and semi_post if we use lock in semwait and semi post is ti correct implementation?

  • @souravdutta7120
    @souravdutta7120 4 года назад

    Really a very clear and apt explanation....
    thank you

  • @AndrewCheetah
    @AndrewCheetah 6 лет назад +1

    Do you use a watchdog to determine whether a process has timed out or not?

  • @Cora-q1z
    @Cora-q1z 5 лет назад

    very interesting and easy to understand. helped me in my project report on semaphores. Thumbs up

  • @iwebappe7981
    @iwebappe7981 6 лет назад +2

    why aren't you incrementing S each time the processus ends ?
    it should be like this :
    s=1
    S=1-1=0
    A executing
    s=0+1=1
    it is because of the time out ? i don't know it

    • @christos94dim75
      @christos94dim75 5 лет назад +1

      semSignal increments s by 1, in this example "A" got interrupted BEFORE finishing its critical section, that means it didnt reach the sesSignal part. Thats the hole point of the semaphore, to not increment s until you are done with you "task", so nobody "messes" with your task , shared data etc.

  • @Angeck
    @Angeck 5 лет назад +1

    Wait so A gets to go twice when C didn't even have one turn?

  • @hamzabenki2864
    @hamzabenki2864 4 года назад

    So well explained. Thank you very much !

  • @tomerbendavid9974
    @tomerbendavid9974 5 лет назад +1

    Excellent video!
    Just watch it in 1.25x speed

  • @user-qc9rq3vb2z
    @user-qc9rq3vb2z 6 лет назад +1

    would each respective semaphore have their own queue of blocked process/threads waiting to use it? Thanks in advance.

    • @JacobSchrum
      @JacobSchrum  3 месяца назад

      Yes, each semaphore maintains its own queue

  • @youneskyba9589
    @youneskyba9589 4 года назад

    Great explanation! Thanks.

  • @yufengyang8182
    @yufengyang8182 4 года назад

    It's really helpful, thank you!

  • @BelieveB23
    @BelieveB23 5 лет назад

    Great explanation sir! Well done. Thanks.

  • @nirvana124
    @nirvana124 5 лет назад +1

    MAY GOD BLESS YOU !! what a nice explanation. thank you so much _/\_

  • @Dpfpv1
    @Dpfpv1 7 лет назад

    can you have an interrupt increment s with semSignal without going through semWait?

  • @vipudank
    @vipudank 6 лет назад +1

    Hi
    I dont understand what you mean by ressource

    • @ThefamousMrcroissant
      @ThefamousMrcroissant 5 лет назад +5

      I'm far too late I'm sure, but: a resource is the object of the synchronization. Say you have a file and several writing threads trying to access it, then clearly you don't want to have them all access it at once. This is the "resource" he speaks of; threads will have to queue up to wait for it.

  • @BenStoneking
    @BenStoneking 5 лет назад

    Great video!

  • @rougejean3524
    @rougejean3524 7 лет назад +23

    thank you my nigga

  • @Res977
    @Res977 6 лет назад

    very helpful, thanks

  • @בנירויטנברג
    @בנירויטנברג 7 лет назад

    הסבר מצויין !!!!! thenk you

  • @Neuroszima
    @Neuroszima 3 месяца назад

    wait. Wouldn't be more simple to just use bool instead of this????

    • @JacobSchrum
      @JacobSchrum  3 месяца назад

      If you are suggesting replacing the entire concept of a semaphore with a single boolean variable, then you are overlooking the fact that updates to a boolean variable in memory are not atomic, and thus do not guarantee synchronization. However, there are alternatives to semaphores that are a bit simpler to use.

    • @Neuroszima
      @Neuroszima 3 месяца назад

      @@JacobSchrum well yeah, i was trying to understand the differences but i guess i have more reading to do. Thanks for pointing an unobvious thing to me

  • @penguin1714
    @penguin1714 5 лет назад +1

    I googled this video so I could know if I was saying it wrong.

  • @grzechupo9199
    @grzechupo9199 4 года назад

    Thank you

  • @sioudiheb5402
    @sioudiheb5402 4 года назад

    Gold blessYou

  • @Engineerblogbihar
    @Engineerblogbihar 3 года назад

    good

  • @karinr7656
    @karinr7656 6 лет назад

    thank you :)

  • @ZiiiP2142
    @ZiiiP2142 7 лет назад

    Cheers.

  • @mohamed_ibrahim07
    @mohamed_ibrahim07 5 лет назад

    thanks!!!

  • @Nwolf1840
    @Nwolf1840 4 года назад +1

    Thank god, I found an American.

  • @sercantor1
    @sercantor1 5 лет назад

    ağzına sağlık