Open main menu

CDOT Wiki β

Changes

Team Darth Vector

827 bytes added, 16:03, 4 December 2017
Added paragraph
===What is a Lock?===
Quick background on A Lock(also called "mutex") is a method for programmers to secure code that when executing in parallel can cause multiple threads to fight for a resource/container for some operation. When threads work in parallel to complete a task with containers, there is no indication when the thread reach the container and need to perform an operation on it. This causes problems when multiple threads are accessing the same place. When doing an insertion on a container with threads, we must ensure only 1 thread is capable of pushing to it or else threads may fight for control. By "Locking" the container, we ensure only 1 thread accesses at any given time.  To use a lock , you program must be working in parallel(ex #include <thread>) and should be completing something in parallel. You can find c++11 locks with #include <mutex> Code example or Picture here ^_^
===Parallelism Problems in STL===
129
edits