[video output=day124 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code template=code124_template.html title="Memory Barriers and Semaphores" vod_platform=youtube id=W_szrzjYuvs annotator=dspecht annotator=ChronalDragon annotator=ZedZull annotator=Miblo]
[0:00:35][Recap/Review]
[0:02:45][Yesterday's TODOs]
[0:04:00][TODO 1: Ordering of writes]
[0:06:33][CompletePastWritesBeforeFutureWrites]
[0:10:22][Looking up memory fences]
[0:12:10][Venturing into Visual Studio's include folder]
[0:13:20][Putting in an actual CPU barrier]
[0:14:32][Where do we go from here?]
[0:15:00][Volatile introduction]
[0:18:43][TODO 2: Interlocked writes]
[0:20:10][Looking up InterlockedIncrement]
[0:21:37][TODO 3: Already taken care of by volatile]
[0:21:54][TODO 4: Ordering of reads]
[0:23:24][Checking our work]
[0:24:20][NB: Don't use all 16 hyperthreads!]
[0:25:45][Job completion]
[0:28:40][Waiting for all the threads to complete]
[0:30:50][Suspending and resuming threads]
[0:34:51][Semaphores]
[0:37:28][WaitForSingleObject for suspending]
[0:40:35][Creating the semaphore]
[0:44:24][Problem: Threads never wake up!]
[0:46:50][Waking up by releasing the semaphore]
[0:53:27][How we'll use the semaphore]
[0:54:26][Testing the semaphore]
[0:56:50][Work for tomorrow]
[0:57:13][Q&A][:speech]
[0:58:24][@d7samurai][In the visual studio output window you can right click and deselect some of the stuff]
[0:58:56][@cubercaleb][Why does this have to be so complicated??]
[0:59:37][@rc1290][Why did you put the memory barrier in a macro when it's platform-specific code?]
[1:00:07][@robrobby][After the sleep, some threads still pushed several strings, leaving out some of the other threads]
[1:00:56][@plain_flavored][Would Sleep(0) in your spin-lock help anything?]
[1:02:35][@abnercoimbre][IMGUI has been trending. Sorry if you get asked this more than you like to.]
[1:03:07][@goodjerm][When you initially started this project, what were the first 5 things you coded and why?]
[1:03:22][@ifingerbangedurcat][I missed most of tonight, what does the volatile keyword mean?]
[1:03:47][@noxy_key][How do you plan to maintain cache line coherency between processors? Can physical CPUs share a cache line?]
[1:05:03][Blackboard: MESI and Cache Coherency]
[1:14:15][@gasto5][Was volatile added in C99?]
[1:14:37][@abnercoimbre][Wait, so transactional memory wants to simplify concurrent programming by allowing a chunk of load/store instructions to execute in atomically. Have you messed with this?]
[1:15:05][Blackboard: Transactional Memory]
[1:18:58][@abnercoimbre][Transactional memory is often advocated as an easier-to-use replacement for locks that avoids any possibility of a deadlock, so I wanted your thoughts.]
[1:21:04][@plainflavored][Why are we building a generic work distribution when the tiled renderer is designed to cleanly split up the work anyway?]
[1:22:45][Wrapping things up][:speech]
[/video]
