Advanced Topics: Peterson's Algorithm for Mutual Exclusion

  Рет қаралды 4,295

Nick

Nick

Күн бұрын

In this video, we look at a few implementations of Peterson's algorithm!
For code samples: github.com/coff...
For live content: / coffeebeforearch

Пікірлер: 8
@eldarcuric3992
@eldarcuric3992 2 жыл бұрын
Your channel is a goldmine! Just amazing.
@nathan-hd6sp
@nathan-hd6sp 3 жыл бұрын
Missing your content Coffee. Hope all is well and you come back with the fire content soon !
@enkidughom2508
@enkidughom2508 2 жыл бұрын
hey man, we missed your videos. hope you get back soon.
@sunday-thequant8477
@sunday-thequant8477 2 жыл бұрын
bro youre a beast! greetings from Mexico!
@kv6257
@kv6257 3 жыл бұрын
thanks for all your channel
@alter-dev2103
@alter-dev2103 3 жыл бұрын
Great video, yet I think what it is really missing is a real example (it is enough to just reference it, or give a link to it). The point is to emphasize that there is a certain set of problems that exist in our real world. And if we want to have a reasonably decent solution(or sometimes any solution at all) to any of those problems, we have to consider this kind of approach of using mfence. Roughly, I would consider mfence a last option, or I mean I believe that you have to be reasonable when choosing this option when solving your problem as it has it's consequences. As you've stated (If I remember correctly) in your recent video that x86 CPUs use internal buffers for micro-operations and their data (which by the way is also sometimes used for predictions) and then contents of those buffers (or more specifically a queue) are distributed between the execution blocks of a core (and that actual distribution may effect code performance by a lot). And so mfence instruction may clear some contents of those CPU buffers and you need to be aware of that if used incorrectly it may really deny your code performance.
@shivnandankumar6688
@shivnandankumar6688 3 жыл бұрын
Is there any requirement of putting memory fence after critical section and before making flag false? Is there any possibility of flag becoming flase before finishing critical section due to reordering?
@NotesByNick
@NotesByNick 3 жыл бұрын
So given that the operation for setting flag[tid] to FALSE is a write, it will not be re-ordered w.r.t any prior reads/writes in the critical section. The only re-ordering modern x86 processors allow is writes with later reads in program order. Reads with later writes are not re-ordered, and writes with later writes are not re-ordered (there are a few cases like non-temporal mov instructions where writes can be reordered w.r.t. other writes, but those are not being used here). I go over the section of the intel SW developers manual that talks about this in the previous video of the series. Cheers, --Nick
Advanced Topics: Hardware Memory Barriers
19:15
Nick
Рет қаралды 7 М.
DekkersAndPetersonsAlgoithms
11:21
Walter Schilling
Рет қаралды 23 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Advanced Topics: False Sharing
18:06
Nick
Рет қаралды 4,6 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 302 М.
C++ Best Practices: RAII
7:35
Nick
Рет қаралды 17 М.
Advanced Topics: Software Memory Barriers
9:27
Nick
Рет қаралды 9 М.
Peterson’s Solution
21:31
Neso Academy
Рет қаралды 450 М.
Advanced Topics: LLVM Compiler Passes
22:27
Nick
Рет қаралды 14 М.
k-mer algorithms: Compare and Swap
5:15
RobEdwards
Рет қаралды 18 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН