Previous: Creating Synchronous Subprocesses, Up: Processes [Index]
In this section, we describe how to create an “asynchronous process”. After an asynchronous process is created, it runs in parallel with Emacs, and Emacs can communicate with it using the functions described in the following sections.
An asynchronous process is controlled either via a “pty” (pseudo-terminal) or a “pipe”. The choice of pty or pipe is made when creating the process, by default based on the value of the variable ‘process-connection-type’ (see below).
If available, ptys are usually preferable for processes visible to the user, as in Shell mode, because they allow for job control (‘C-c’, ‘C-z’, etc.) between the process and its children, and because interactive programs treat ptys as terminal devices, whereas pipes don’t support these features. The total number of ptys is limited on many systems, and it is good not to waste them unnecessarily.
However, for subprocesses used by Lisp programs for internal purposes (i.e., no user interaction with the subprocess is required), where significant amounts of data need to be exchanged between the subprocess and the Lisp program, it is often better to use a pipe, because pipes are more efficient.