Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Software design pattern
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== [[Concurrency patterns]] === {| class="wikitable" |- ! Name ! Description ! In ''[[Pattern-Oriented Software Architecture|POSA2]]''<ref name="POSA2">{{cite book | first1 = Douglas C. | last1 = Schmidt | first2 = Michael | last2 = Stal | first3 = Hans | last3 = Rohnert | first4 = Frank | last4 = Buschmann | date = 2000 | title = Pattern-Oriented Software Architecture, Volume 2: Patterns for Concurrent and Networked Objects | publisher = John Wiley & Sons | isbn = 978-0-471-60695-6 }}</ref> ! Other |- | [[Active Object]] | Decouples method execution from method invocation that reside in their own thread of control. The goal is to introduce concurrency, by using [[asynchronous method invocation]] and a [[scheduling (computing)|scheduler]] for handling requests. | {{yes}} | {{n/a}} |- | [[Balking pattern|Balking]] | Only execute an action on an object when the object is in a particular state. | {{no}} | {{n/a}} |- | [[Binding properties pattern|Binding properties]] | Combining multiple observers to force properties in different objects to be synchronized or coordinated in some way.<ref>[http://c2.com/cgi/wiki?BindingProperties Binding Properties<!-- Bot generated title -->]</ref> | {{no}} | {{n/a}} |- | [[Compute kernel]] | The same calculation many times in parallel, differing by integer parameters used with non-branching pointer math into shared arrays, such as [[GPU]]-optimized [[Matrix multiplication]] or [[Convolutional neural network]]. | {{no}} | {{n/a}} |- | [[Double-checked locking]] | Reduce the overhead of acquiring a lock by first testing the locking criterion (the 'lock hint') in an unsafe manner; only if that succeeds does the actual locking logic proceed. Can be unsafe when implemented in some language/hardware combinations. It can therefore sometimes be considered an [[anti-pattern]]. | {{yes}} | {{n/a}} |- | [[Event-Based Asynchronous Pattern|Event-based asynchronous]] | Addresses problems with the asynchronous pattern that occur in multithreaded programs.<ref name="PC#2008">{{cite book|title = Professional C# 2008| first1 = Christian | last1 = Nagel | first2 = Bill | last2 = Evjen | first3 = Jay | last3 = Glynn | first4 = Karli | last4 = Watson | first5 = Morgan | last5 = Skinner|pages = 570–571|publisher = Wiley|year = 2008|isbn = 978-0-470-19137-8|chapter = Event-based Asynchronous Pattern}}</ref> | {{no}} | {{n/a}} |- | [[Guarded suspension]] | Manages operations that require both a lock to be acquired and a precondition to be satisfied before the operation can be executed. | {{no}} | {{n/a}} |- | [[Join-pattern|Join]] | Join-pattern provides a way to write concurrent, parallel and distributed programs by message passing. Compared to the use of threads and locks, this is a high-level programming model. | {{no}} | {{n/a}} |- | [[Lock (computer science)|Lock]] | One thread puts a "lock" on a resource, preventing other threads from accessing or modifying it.<ref>[http://c2.com/cgi/wiki?LockPattern Lock Pattern<!-- Bot generated title -->]</ref> | {{no}} | {{yes|PoEAA<ref name = "PoEAA"/>}} |- | [[Messaging pattern|Messaging design pattern (MDP)]] | Allows the interchange of information (i.e. messages) between components and applications. | {{no}} | {{n/a}} |- | [[Monitor (synchronization)|Monitor object]] | An object whose methods are subject to [[mutual exclusion]], thus preventing multiple objects from erroneously trying to use it at the same time. | {{yes}} | {{n/a}} |- | [[Reactor pattern|Reactor]] | A reactor object provides an asynchronous interface to resources that must be handled synchronously. | {{yes}} | {{n/a}} |- | [[Read-write lock]] | Allows concurrent read access to an object, but requires exclusive access for write operations. An underlying semaphore might be used for writing, and a [[Copy-on-write]] mechanism may or may not be used. | {{no}} | {{n/a}} |- | [[Scheduler pattern|Scheduler]] | Explicitly control when threads may execute single-threaded code. | {{no}} | {{n/a}} |- | Service handler pattern | For each request, a server spawns a dedicated client handler to handle a request.<ref>{{cite journal |last1=Francalanza |first1=Adrian |last2=Tabone |first2=Gerard |title=ElixirST: A session-based type system for Elixir modules |journal=Journal of Logical and Algebraic Methods in Programming |date=October 2023 |volume=135 |doi=10.1016/j.jlamp.2023.100891|s2cid=251442539 }}</ref> Also referred to as ''thread-per-session''.<ref>{{cite journal |last1=Schmidt |first1=Douglas C. |last2=Vinoski |first2=Steve |title=Object Interconnections: Comparing Alternative Programming Techniques for Multi-threaded CORBA Servers (Column 7) |date=July–August 1996 |journal=SIGS C++ Report |url=https://www.dre.vanderbilt.edu/~schmidt/PDF/C++-report-col7.pdf |s2cid=2654843}}</ref> | {{no}} | {{n/a}} |- | [[Thread pool]] | A number of threads are created to perform a number of tasks, which are usually organized in a queue. Typically, there are many more tasks than threads. Can be considered a special case of the [[object pool]] pattern. | {{no}} | {{n/a}} |- | [[Thread-specific storage]] | Static or "global" memory local to a thread. | {{yes}} | {{n/a}} |- | Safe Concurrency with Exclusive Ownership | Avoiding the need for runtime concurrent mechanisms, because exclusive ownership can be proven. This is a notable capability of the Rust language, but compile-time checking isn't the only means, a programmer will often manually design such patterns into code - omitting the use of locking mechanism because the programmer assesses that a given variable is never going to be concurrently accessed. | {{no}} | {{n/a}} |- | CPU atomic operation | x86 and other CPU architectures support a range of atomic instructions that guarantee memory safety for modifying and accessing primitive values (integers). For example, two threads may both increment a counter safely. These capabilities can also be used to implement the mechanisms for other concurrency patterns as above. The [[C Sharp (programming language)|C#]] language uses the [https://docs.microsoft.com/en-us/dotnet/api/system.threading.interlocked?view=net-5.0 Interlocked] class for these capabilities. | {{no}} | {{n/a}} |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)