Asynchronous procedure call

From Wikipedia, the free encyclopedia

An asynchronous procedure call (APC) is a unit of work in a computer.

Definition[edit]

Procedure calls can be synchronous or asynchronous. Synchronous procedure calls are made on one thread in a series, with each call waiting for the prior call to complete. on some thread. APCs instead are made without waiting for prior calls to complete.

For example, if some data are not ready (for example, a program waits for a user to reply), then stopping other activity on the thread is expensive, the thread has consumed memory and potentially other resources.

Structure[edit]

An APC is typically formed as an object with a small amount of memory and this object is passed to a service which handles the wait interval, activating it when the appropriate event (e.g., user input) occurs.

The life cycle of an APC consists of 2 stages: the passive stage, when it passively waits for input data, and active state, when that data is calculated in the same way as at the usual procedure call.

A reusable asynchronous procedure is termed Actor. In the Actor model two ports are used: one to receive input, and another (hidden) port to handle the input. In Dataflow programming many ports are used, passing to an execution service when all inputs are present.

Implementations[edit]

In Windows, APC is a function that executes asynchronously in the context of a specific thread.[1] APCs can be generated by the system (kernel-mode APCs) or by an application (user mode APCs).[1]

See also[edit]

References[edit]

  1. ^ a b "Asynchronous Procedure Calls (Windows)". Retrieved 1 March 2017.