Open main menu

CDOT Wiki β

Changes

Team Darth Vector

208 bytes added, 14:42, 9 December 2017
m
Parallelism Problems in STL
Note that there can be problems with locks. If a thread is locked but it is never unlocked, any other threads will be forced to wait which may cause performance issues. Another problem is called "Dead Locking" where each thread may be waiting for another to unlock (and vice versa) and the program is forced to wait and wait .
===Parallelism Problems & Convoying in STL===
Within STL, issues arise when you attempt to access containers in parallel. With containers, when threads update the container say with push back, it is difficult to determine where the insertion occurred within the container(each thread is updating this container in any order) additionally it , the size of the container is unknown as each thread may update be updating the size as it goes(thread A may see a size of 4 while thread B a size of 9). For example, in a vector we can push some data to it in parallel but knowing where that data was pushed to requires as us to search iterate through the vector serially for that data's the exact location. If we attempt to find the data in parallelwith other operations ongoing, 1 thread could search for the data, but another could update the vector size during that time which causes problems with thread 1's searchas the memory location may change should the vector need to grow(performs a deep copy to new memory).
Locks can solve the above issue but cause significant performance issues as the threads are forced to wait for each other.
129
edits