1 00:00:06,590 --> 00:00:09,440 - Welcome to lesson nine, data races. 2 00:00:09,440 --> 00:00:12,340 This is where we start learning important topics 3 00:00:12,340 --> 00:00:15,470 around synchronization and orchestration, 4 00:00:15,470 --> 00:00:18,910 but we're really gonna focus around synchronization here. 5 00:00:18,910 --> 00:00:20,530 These are the two things you have to worry about 6 00:00:20,530 --> 00:00:22,820 as a multi-threaded software developer, 7 00:00:22,820 --> 00:00:24,740 synchronization and orchestration, 8 00:00:24,740 --> 00:00:26,970 and data races are one of these places 9 00:00:26,970 --> 00:00:30,670 where it is the nastiest bugs you ever wanna have. 10 00:00:30,670 --> 00:00:32,340 This is where we've got at least two go routines 11 00:00:32,340 --> 00:00:35,200 where one's doing a read and one is doing a write 12 00:00:35,200 --> 00:00:37,620 at the same time, at the same memory location. 13 00:00:37,620 --> 00:00:38,550 This is bad. 14 00:00:38,550 --> 00:00:40,110 So I'm gonna show off some data races, 15 00:00:40,110 --> 00:00:42,670 I'm gonna show off the race detector tool, 16 00:00:42,670 --> 00:00:45,690 I'm gonna show you ways using atomic and mutexes 17 00:00:45,690 --> 00:00:48,620 to fix those data races, and we're gonna learn 18 00:00:48,620 --> 00:00:51,070 a little bit more about our mechanical sympathies 19 00:00:51,070 --> 00:00:52,433 for how the hardware works.