Похожие чаты

When you program concurrently the variables are exposed being shared

and that is where the channel comes in to ensure communication in a safe way in a competitive scenario.
In Go it is possible to use the synchronization primitives and this is very interesting because he did not eliminate this possibility, the language allows its use, in the past we did not have Maps to work in a competing environment, for this to be possible we had to implement and see just how could we do this? Using Mutex ... This is an implementation that I did in the past https://gist.github.com/jeffotoni/13160dcac45068f31d56193cd0cbbe49 and just below in the answer another solution using sync.Map.
The examples in the post depict to take care and reflect more on primitives using Mutex and Channel, and that in some scenarios it is interesting to use primitives instead of channel, super valid from his point of view, he needed to lower the level even more in his projects .
It will arrive at a moment that will come up against GC do Go in the memory heaps and then the conversation starts to get even more interesting.
Remembering that Go is a new lang, which is maturing and advancing very fast, it has several points that need to improve as in any other lang.
Now, like Go community, I'm sure there are few like ours... 🥳🥳🥳🥳
but
But we know that the use of sync.Mutex when we have thousands of goroutines the performance is affected, making a very simple benchmarking to understand but read this post
https://stackoverflow.com/questions/57562606/why-does-sync-mutex-largely-drop-performance-when-goroutine-contention-is-more-t

1 ответов

14 просмотров

thanks I get the difference between channels and concurrency primitives, I just don't really understand the example in the premise of the article

Похожие вопросы

Обсуждают сегодня

а через ESC-код ?
Alexey Kulakov
29
30500 за редактор? )
Владимир
47
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
13
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
9
Карта сайта