Multi-threading basics Main process forks additional processing threads Takes advantage of multiple processors, or CPU dead times while waiting for data Synchronization: When one thread needs the results of processing happening in another thread, (i.e. one thread will wait) Locks: multiple threads might need to access the same data. They have to lock it/manipulate it/unlock it (as quick as possible)
22
Embed
Multi-threading basics Main process forks additional processing threads Takes advantage of multiple processors, or CPU dead times while waiting for data.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Multi-threading basicsMulti-threading basicsMain process forks additional processing threadsTakes advantage of multiple processors, or CPU dead times while waiting for dataSynchronization: When one thread needs the results of processing happening in another thread, (i.e. one thread will wait)Locks: multiple threads might need to access the same data. They have to lock it/manipulate it/unlock it (as quick as possible)
Need thread-aware profilersProfiling may hide many synchronization stallsHome-grown spin locks make profiling harderConsider instrumenting calls to synchronization functions
Don't use locks in instrumentation
Windows: Intel VTune, AMD CodeAnalyst, and the Visual Studio Team System ProfilerXbox 360: PIX, XbPerfView, etc.
Windows tipsWindows tips
Avoid using wglMakeCurrent or this.Invoke()
Best to do all rendering calls from a single thread