This reminds me of something I was trying to do in Programming Assignment 2. I had a map of TaskIds->ints where the integers were the number of dependencies that particular task had. My implementation ended up using coarse-grained synchronization, however, I was thinking of defining the map in the following way: myMap>. I went to office hours to ask about the differences between these two approaches and was told that atomics do not guarantee a certain ordering while locks can. I am still a bit confused as to what this means. Are there any key differences in program execution/correctness between using coarse-grained synchronization and fine-grained synchronization in this specific scenario?
This reminds me of something I was trying to do in Programming Assignment 2. I had a map of TaskIds->ints where the integers were the number of dependencies that particular task had. My implementation ended up using coarse-grained synchronization, however, I was thinking of defining the map in the following way: myMap>. I went to office hours to ask about the differences between these two approaches and was told that atomics do not guarantee a certain ordering while locks can. I am still a bit confused as to what this means. Are there any key differences in program execution/correctness between using coarse-grained synchronization and fine-grained synchronization in this specific scenario?