''One of the SynchronizationStrategies.'' CodeLocking uses global locks (CriticalSection) that are associated with a given algorithm rather than a given object (or instance of data structure), that it, it advocates rather coarse grained parallelism. The advantage of CodeLocking is that the resulting code is often very similar to the serial code, which means that it is easier to incorporate modifications to the serial version of the program into the parallel version of the program, which can result in lower DevMaintCost. The main disadvantage is that the SpeedUp obtainable through CodeLocking is usually rather modest -- ConTention is high, and attempts to reduce it through finer-grained parallelism usually result in excessive OverHead. ---- Forget SpeedUp, this technique can reduce synchronization bugs by reducing the number of threads entering a section of code to one (or n depending on your lock). If you have non-reentrant code, this technique will remove any fear that state will be corrupted. Also, it can be an effective strategy to solve weird multithreading problems like the DiningPhilosophers problem. -- SunirShah ''Can you show some examples of CodeLocking?'' * MemoryManagement: Allow one allocation of memory to occur at a time (no concurrency of multiple allocations during the algorithm for finding a free piece of ram). ---- Implementation example in Java-speak: Declaring a method, that implements the algorithm as synchronized, instead of synchronizing on each visited or modified element in the data-structure processed by the algorithm. ---- See SynchronizationStrategies, CodeLocking, CriticalSection, SoftwareMonitor