concurrent computing for a more theoretical discussion see concurrency computer science programming paradigms action agentoriented arrayoriented automatabased concurrent computing relativistic programming datadriven declarative contrast imperative functional functional logic purely functional logic abductive logic answer set concurrent logic functional logic inductive logic constraint constraint logic concurrent constraint logic dataflow flowbased reactive dynamicscripting eventdriven functionlevel contrast valuelevel pointfree style concatenative generic imperative contrast declarative procedural objectoriented literate languageoriented naturallanguage programming disciplinespecific domainspecific grammaroriented intentional metaprogramming automatic inductive programming reflective attributeoriented macro template nonstructured contrast structured array nondeterministic parallel computing processoriented probabilistic stackbased structured contrast nonstructured blockstructured objectoriented actorbased classbased concurrent prototypebased by separation of concerns aspectoriented roleoriented subjectoriented recursive symbolic valuelevel contrast functionlevel quantum programming vte concurrent computing is a form of computing in which several computations are executed during overlapping time periodsconcurrentlyinstead of sequentially one completing before the next starts this is a property of a systemthis may be an individual program a computer or a networkand there is a separate execution point or thread of control for each computation process a concurrent system is one where a computation can advance without waiting for all other computations to complete as a programming paradigm concurrent computing is a form of modular programming namely factoring an overall computation into subcomputations that may be executed concurrently pioneers in the field of concurrent computing include edsger dijkstra per brinch hansen and car hoare introduction see also parallel computing the concept of concurrent computing is frequently confused with the related but distinct concept of parallel computing1 for example concurrent processes can be executed on one core by interleaving the execution steps of each process via timesharing slices only one process runs at a time and if it does not complete during its time slice it is paused another process begins or resumes and then later the original process is resumed in this way multiple processes are partway through execution at a single instant but only one process is being executed at that instant concurrent computations may be executed in parallel the exact timing of when tasks in a concurrent system are executed depend on the scheduling and tasks need not always be executed concurrently for example given two tasks t1 and t2 t1 may be executed and finished before t2 or vice versa serial and sequential t1 and t2 may be executed alternately serial and concurrent t1 and t2 may be executed simultaneously at the same instant of time parallel and concurrent the word sequential is used as an antonym for both concurrent and parallel when these are explicitly distinguished concurrentsequential and parallelserial are used as opposing pairs coordinating access to shared resources the main challenge in designing concurrent programs is concurrency control ensuring the correct sequencing of the interactions or communications between different computational executions and coordinating access to resources that are shared among executions potential problems include race conditions deadlocks and resource starvation for example consider the following algorithm to make withdrawals from a checking account represented by the shared resource balance 1 bool withdrawint withdrawal 2 3 if balance withdrawal 4 5 balance withdrawal 6 return true 7 8 return false 9 suppose balance 500 and two concurrent threads make the calls withdraw300 and withdraw350 if line 3 in both operations executes before line 5 both operations will find that balance withdrawal evaluates to true and execution will proceed to subtracting the withdrawal amount however since both processes perform their withdrawals the total amount withdrawn will end up being more than the original balance these sorts of problems with shared resources benefit from the use of concurrency control or nonblocking algorithms advantages this section does not cite any sources please help improve this section by adding citations to reliable sources unsourced material may be challenged and removed december 2006 learn how and when to remove this template message concurrent computing has the following advantages increased program throughputparallel execution of a concurrent program allows the number of tasks completed in a given time to increase proportionally to the number of processors according to gustafsons law high responsiveness for inputoutputinputoutputintensive programs mostly wait for input or output operations to complete concurrent programming allows the time that would be spent waiting to be used for another task more appropriate program structuresome problems and problem domains are wellsuited to representation as concurrent tasks or processes models there are several models of concurrent computing which can be used to understand and analyze concurrent systems these models include actor model objectcapability model for security petri nets process calculi such as ambient calculus calculus of communicating systems ccs communicating sequential processes csp calculus joincalculus inputoutput automaton preemptive machine scheduling implementation this section needs expansion you can help by adding to it february 2014 a number of different methods can be used to implement concurrent programs such as implementing each computational execution as an operating system process or implementing the computational processes as a set of threads within a single operating system process interaction and communication in some concurrent computing systems communication between the concurrent components is hidden from the programmer eg by using futures while in others it must be handled explicitly explicit communication can be divided into two classes shared memory communication concurrent components communicate by altering the contents of shared memory locations exemplified by java and c this style of concurrent programming usually needs the use of some form of locking eg mutexes semaphores or monitors to coordinate between threads a program that properly implements any of these is said to be threadsafe message passing communication concurrent components communicate by exchanging messages exemplified by scala erlang and occam the exchange of messages may be carried out asynchronously or may use a synchronous rendezvous style in which the sender blocks until the message is received asynchronous message passing may be reliable or unreliable sometimes referred to as send and pray messagepassing concurrency tends to be far easier to reason about than sharedmemory concurrency and is typically considered a more robust form of concurrent programming a wide variety of mathematical theories to understand and analyze messagepassing systems are available including the actor model and various process calculi message passing can be efficiently implemented via symmetric multiprocessing with or without shared memory cache coherence shared memory and message passing concurrency have different performance characteristics typically although not always the perprocess memory overhead and task switching overhead is lower in a message passing system but the overhead of message passing is greater than for a procedure call these differences are often overwhelmed by other performance factors history concurrent computing developed out of earlier work on railroads and telegraphy from the 19th and early 20th century and some terms date to this period such as semaphores these arose to address the question of how to handle multiple trains on the same railroad system avoiding collisions and maximizing efficiency and how to handle multiple transmissions over a given set of wires improving efficiency such as via timedivision multiplexing 1870s the academic study of concurrent algorithms started in the 1960s with dijkstra 1965 credited with being the first paper in this field identifying and solving mutual exclusion prevalence concurrency is pervasive in computing occurring from lowlevel hardware on a single chip to worldwide networks examples follow at the programming language level channel coroutine futures and promises at the operating system level computer multitasking including both cooperative multitasking and preemptive multitasking timesharing which replaced sequential batch processing of jobs with concurrent use of a system process thread at the network level networked systems are generally concurrent by their nature as they consist of separate devices languages supporting concurrent programming concurrent programming languages are programming languages that use language constructs for concurrency these constructs may involve multithreading support for distributed computing message passing shared resources including shared memory or futures and promises such languages are sometimes described as concurrencyoriented languages or concurrencyoriented programming languages copl today the most commonly used programming languages that have specific constructs for concurrency are java and c both of these languages fundamentally use a sharedmemory concurrency model with locking provided by monitors although messagepassing models can and have been implemented on top of the underlying sharedmemory model of the languages that use a messagepassing concurrency model erlang is probably the most widely used in industry at present many concurrent programming languages have been developed more as research languages eg pict rather than as languages for production use however languages such as erlang limbo and occam have seen industrial use at various times in the last 20 years languages in which concurrency plays an important role include adageneral purpose with native support for message passing and monitor based concurrency alefconcurrent with threads and message passing for system programming in early versions of plan 9 from bell labs aliceextension to standard ml adds support for concurrency via futures ateji pxextension to java with parallel primitives inspired from calculus axumdomain specific concurrent based on actor model and net common language runtime using a clike syntax bmdfmbinary modular dataflow machine cstdthread c c omegafor research extends c uses asynchronous communication csupports concurrent computing using lock yield also since version 50 async and await keywords introduced clojuremodern functional dialect of lisp on the java platform concurrent cleanfunctional programming similar to haskell concurrent collections cncachieves implicit parallelism independent of memory model by explicitly defining flow of data and control concurrent haskelllazy pure functional language operating concurrent processes on shared memory concurrent mlconcurrent extension of standard ml concurrent pascalby per brinch hansen curry dmultiparadigm system programming language with explicit support for concurrent programming actor model euses promises to preclude deadlocks ecmascriptpromises available in various libraries proposed for inclusion in standard in ecmascript 6 eiffelthrough its scoop mechanism based on the concepts of design by contract elixirdynamic and functional metaprogramming aware language running on the erlang vm erlanguses asynchronous message passing with nothing shared faustrealtime functional for signal processing compiler provides automatic parallelization via openmp or a specific workstealing scheduler fortrancoarrays and do concurrent are part of fortran 2008 standard gofor system programming with a concurrent programming model based on csp humefunctional concurrent for bounded space and time environments where automata processes are described by synchronous channels patterns and message passing ioactorbased concurrency janusfeatures distinct askers and tellers to logical variables bag channels is purely declarative javathread class or runnable interface juliaconcurrent programming primitives tasks asyncwait channels javascriptvia web workers in a browser environment promises and callbacks jocamlconcurrent and distributed channel based extension of ocaml implements the joincalculus of processes join javaconcurrent based on java language jouledataflowbased communicates by message passing joyceconcurrent teaching built on concurrent pascal with features from csp by per brinch hansen labviewgraphical dataflow functions are nodes in a graph data is wires between the nodes includes objectoriented language limborelative of alef for system programming in inferno operating system multilispscheme variant extended to support parallelism modula2for system programming by n wirth as a successor to pascal with native support for coroutines modula3modern member of algol family with extensive support for threads mutexes condition variables newsqueakfor research with channels as firstclass values predecessor of alef occaminfluenced heavily by communicating sequential processes csp occama modern variant of occam which incorporates ideas from milners calculus orcheavily concurrent nondeterministic based on kleene algebra ozmozartmultiparadigm supports sharedstate and messagepassing concurrency and futures parasailobjectoriented parallel free of pointers race conditions pictessentially an executable implementation of milners calculus perl with anyevent and coro perl 6 includes classes for threads promises and channels by default python with twisted greenlet and gevent or using stackless python reiauses asynchronous message passing between sharednothing objects redsystemfor system programming based on rebol ruby with concurrent ruby and celluloid rustfor system programming using messagepassing with move semantics shared immutable memory and shared mutable memory salsaactorbased with tokenpassing join and firstclass continuations for distributed computing over the internet scalageneral purpose designed to express common programming patterns in a concise elegant and typesafe way sequencelgeneral purpose functional main design objectives are ease of programming code clarityreadability and automatic parallelization for performance on multicore hardware and provably free of race conditions srfor research stratifiedjscombinatorbased concurrency based on javascript superpascalconcurrent for teaching built on concurrent pascal and joyce by per brinch hansen uniconfor research termite schemeadds erlanglike concurrency to scheme tnsdlfor developing telecommunication exchanges uses asynchronous message passing vhsic hardware description language vhdlieee std1076 xcconcurrencyextended subset of c language developed by xmos based on communicating sequential processes builtin constructs for programmable io many other languages provide support for concurrency in the form of libraries at levels roughly comparable with the above list list of important publications in concurrent parallel and distributed computing asynchronous io chu space flowbased programming ptolemy project race condition sheaf mathematics software transactional memory transaction processing java concurrentmap notes this article needs additional citations for verification please help improve this article by adding citations to reliable sources unsourced material may be challenged and removed february 2014 learn how and when to remove this template message patterson david a hennessy john l 2013 computer organization and design the hardwaresoftware interface the morgan kaufmann series in computer architecture and design 5 ed morgan kaufmann isbn9780124078864 dijkstra e w 1965 solution of a problem in concurrent programming control communications of the acm 8 9 569 doi101145365559365617 herlihy maurice 2008 the art of multiprocessor programming morgan kaufmann isbn9780123705914 downey allen b 2005 the little book of semaphores pdf green tea press isbn1441418687 filman robert e daniel p friedman 1984 coordinated computing tools and techniques for distributed software new york mcgrawhill p370 isbn0070224390 leppjrvi jouni 2008 a pragmatic historically oriented survey on the universality of synchronization primitives pdf university of oulu taubenfeld gadi 2006 synchronization algorithms and concurrent programming pearson prentice hall p433 isbn0131972596 media related to concurrent programming at wikimedia commons concurrent systems virtual library vteedsger dijkstranotable works a primer of algol 60 programming book structured programming book a discipline of programming book a method of programming book predicate calculus and program semantics book selected writings on computing a personal perspective book selected papers ewd manuscripts a note on two problems in connexion with graphs cooperating sequential processes solution of a problem in concurrent programming control the structure of the themultiprogramming system go to statement considered harmful notes on structured programming the humble programmer programming considered as a human activity how do we tell truths that might hurt on the role of scientific thought selfstabilizing systems in spite of distributed control on the cruelty of really teaching computer science main research areas theoretical computing science software engineering systems science algorithm design concurrent computing distributed computing formal methods programming methodology programming language research program design and development software architecture philosophy of computer programming and computing science scientific contributionsconcepts and methods algol 60 implementation call stack concurrency concurrent programming cooperating sequential processes critical section deadly embrace deadlock dining philosophers problem dutch national flag problem faulttolerant system gotoless programming guarded command language layered structure in software architecture levels of abstraction multithreaded programming mutual exclusion mutex producerconsumer problem bounded buffer problem program families predicate transformer semantics process synchronization selfstabilizing distributed system semaphore programming separation of concerns sleeping barber problem software crisis structured analysis structured programming the multiprogramming system unbounded nondeterminism weakest precondition calculus algorithms bankers algorithm dijkstras algorithm djp algorithm prims algorithm dijkstrascholten algorithm dekkers algorithm generalization smoothsort shuntingyard algorithm tricolor marking algorithm concurrent algorithms distributed algorithms deadlock prevention algorithms mutual exclusion algorithms selfstabilizing algorithms related people shlomi dolev per brinch hansen tony hoare olejohan dahl leslie lamport david parnas adriaan van wijngaarden niklaus wirth other topics dijkstra prize edsger w dijkstra prize in distributed computing centrum wiskunde informatica ew dijkstra archive university of texas at austin list of pioneers in computer science list of important publications in computer science list of important publications in theoretical computer science list of important publications in concurrent parallel and distributed computing international symposium on stabilization safety and security of distributed systems wikiquote vteconcurrent computinggeneral concurrency concurrency control process calculi csp ccs acp lotos calculus ambient calculus apicalculus pepa joincalculus classic problems aba problem cigarette smokers problem deadlock dining philosophers problem producerconsumer problem race condition readerswriters problem sleeping barber problem category concurrent computing vtetypes of programming languages actorbased array aspectoriented classbased concatenative concurrent dataflow declarative domainspecific dynamic esoteric eventdriven extensible functional imperative logic macro metaprogramming multiparadigm objectbased objectoriented pipeline procedural prototypebased reflective rulebased scripting stack based synchronous templating assembly compiled interpreted machine lowlevel highlevel very highlevel first generation second generation third generation fourth generation fifth generation nonenglishbased visual 