Asynchrony, in
computer programming
Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
, refers to the occurrence of events independent of the main
program flow
In computer science, control flow (or flow of control) is the order in which individual Statement (computer science), statements, Instruction (computer science), instructions or function calls of an imperative programming, imperative computer pro ...
and ways to deal with such events. These may be "outside" events such as the arrival of
signals
A signal is both the process and the result of Signal transmission, transmission of data over some transmission media, media accomplished by embedding some variation. Signals are important in multiple subject fields including signal processin ...
, or actions instigated by a program that take place
concurrently with program execution, without the program
hanging
Hanging is killing a person by suspending them from the neck with a noose or ligature strangulation, ligature. Hanging has been a standard method of capital punishment since the Middle Ages, and has been the primary execution method in numerou ...
to wait for results.
Asynchronous input/output is an example of the latter case of asynchrony, and lets programs issue commands to storage or network devices that service these requests while the
processor continues executing the program. Doing so provides a degree of
concurrency.
A common way for dealing with asynchrony in a
programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build su ...
is to provide
subroutine
In computer programming, a function (also procedure, method, subroutine, routine, or subprogram) is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times.
Callable units provide a ...
s that return a
future or promise that represents the ongoing operation, and a synchronizing operation that
blocks until the future or promise is completed. Some programming languages, such as
Cilk
Cilk, Cilk++, Cilk Plus and OpenCilk are general-purpose programming languages designed for multithreaded parallel computing. They are based on the C and C++ programming languages, which they extend with constructs to express parallel loop ...
, have special syntax for expressing an asynchronous procedure call.
Examples of asynchrony include the following:
*
Asynchronous procedure call, a method to run a procedure concurrently, a lightweight alternative to
threads.
*
Ajax
Ajax may refer to:
Greek mythology and tragedy
* Ajax the Great, a Greek mythological hero, son of King Telamon and Periboea
* Ajax the Lesser, a Greek mythological hero, son of Oileus, the king of Locris
* Ajax (play), ''Ajax'' (play), by the an ...
is a set of
client-side web technologies used by the client to create asynchronous I/O
web application
A web application (or web app) is application software that is created with web technologies and runs via a web browser. Web applications emerged during the late 1990s and allowed for the server to dynamically build a response to the request, ...
s.
* Asynchronous method dispatch (AMD), a
data communication
Data communication, including data transmission and data reception, is the transfer of data, transmitted and received over a point-to-point or point-to-multipoint communication channel. Examples of such channels are copper wires, optic ...
method used when there is a need for the server side to handle a large number of long lasting client requests.
ICE usage of AMD
Using synchronous method dispatch (SMD), this scenario may turn the server into an unavailable busy state resulting in a connection failure response caused by a network connection request timeout. The servicing of a client request is immediately dispatched to an available thread from a pool of threads and the client is put in a blocking state. Upon the completion of the task, the server is notified by a callback. The server unblocks the client and transmits the response back to the client. In case of thread starvation
Starvation is a severe deficiency in caloric energy intake, below the level needed to maintain an organism's life. It is the most extreme form of malnutrition. In humans, prolonged starvation can cause permanent organ damage and eventually, de ...
, clients are blocked waiting for threads to become available.
See also
* Asynchronous system
The primary focus of this article is asynchronous control in digital electronic systems. In a synchronous system, operations ( instructions, calculations, logic, etc.) are coordinated by one, or more, centralized clock signals. An asynchro ...
* Asynchronous circuit
Asynchronous circuit (clockless or self-timed circuit) is a sequential logic, sequential digital logic electrical network, circuit that does not use a global clock circuit or clock signal, signal generator to synchronize its components. Instea ...
References
Computer programming
Inter-process communication
Middleware
{{comp-sci-stub