The Daily Go
338 subscribers
53 photos
2 videos
3 files
657 links
We provide you daily Golang contents. If you want to post any content contact with us.
.
Administrators:
👉🏻@aidenzibaei
👉🏻@amin_khozaei

#jaryan904259
Download Telegram
The Daily Go
Why are map operations not defined to be atomic?

After long discussion it was decided that the typical use of maps did not require safe access from multiple goroutines, and in those cases where it did, the map was probably part of some larger data structure or computation that was already synchronized. Therefore requiring that all map operations grab a mutex would slow down most programs and add safety to few. This was not an easy decision, however, since it means uncontrolled map access can crash the program.

The language does not preclude atomic map updates. When required, such as when hosting an untrusted program, the implementation could interlock map access.

golng.ml/2052

#Why #Goroutines #Concurrency