Changes

Jump to: navigation, search

GPU621/Group 6

603 bytes added, 09:20, 28 November 2018
Race Conditions
===Race Conditions===
Race conditions are defined as a A race condition where occurs when multiple threads access the output same memory location without proper synchronization and at least one access is dependent on uncontrollable events sequence or timinga write.  There are multiple types of race conditions, such as#Data Race:a data race is a type of race condition that occurs Occurs when multiple threads attempt to perform an operation on shared data, a heap race that #Heap Race: performs operations on a shared heap, or #Stack Race: Performs operations on a shared stack race. '''Solutions''' Privatize memory shared by multiple threads so each thread has its own copy.#For Microsoft Windows* threading, consider using TlsAlloc() and TlsFree() to allocate thread local storage.#For OpenMP* threading, which performs on consider declaring the variable in a private, firstprivate, or lastprivate clause, or making it threadprivate. Consider using thread stack memory.Synchronize access to the shared stackmemory using synchronization objects.#For Microsoft Windows* threading, consider using mutexes or critical sections.#For OpenMP* threading, consider using atomic or critical sections or OpenMP* locks
[[File:Race-Condition.png|800px]]
46
edits

Navigation menu