[Autogenerated] Reference of the Sema four is to limit something.
For example, we can limit the size of a QoS four properly.
When we create a sem,
up four we set the initial maximum count of the SEM four we can think of it
in a different way by allowing certain number of threads.
To go through a gate of sorts.
That is limited by the number used inside the SEMA four When the 74 count,
is greater than zero, the 74 is considered signal,
and the thread can succeed the weight at that point,
the counter of the 74 drops by one when another thread
acquires the 7-Up four tries to get access to the 74 by
call weight for a single object.
Again, if the counter is greater than zero it,
is going to move forward,
and the counter will drop by one until eventually
the 74 count might drop to zero.
When it becomes zero, the center four becomes non signaled.
Any subsequent weights will have to Wait until some other thread.
Call release, 74 to increment, the 74 count back.
So, that it becomes signaled again.
That's the basic idea of the 74 this is the main use case of 7-Up,
four Now,
here's the question for you based on what we discussed about T
access in the previous module is a center four with a maximum
count of one equivalent to a Tex, think about it.
You can pause the video, and think about it.
A little bit.
So here's the answer, the answer.
Is no, and The reason, is that a self four doesn't have any concept of ownership,
which means that If a thread requires the center four So,
to speak.
There's really no acquisition involved if it tries to require the 74 again,
it will deadlock because the center first count will drop to zero,
and now its deadlocked because nobody else.
Is going to probably increment, that center four and As we see this is In fact,
an advantage of a 74 in general, or perhaps I should say,
a property of the 74 which can be properly used and
That's because the 74 purpose, is very different than that of a Tex,
a Tex, is for protecting access to shared data So,
that only one thread can access the shared data at a time.
The purpose of the 74 is to limit something, and We'll see.
That in the Next demo.