 asynchronous system trap (ast) refers to a mechanism used in several computer operating systems designed by the former digital equipment corporation (dec) of maynard, massachusetts. various events within these systems can be optionally signalled back to the user processes via the ast mechanism. these asts act like subroutine calls but they are delivered asynchronously, that is, without any regard to the context of the main thread. because of this, care must be taken: * to ensure that any code that is shared between the main thread and the ast must be designed to be reentrant, and * any data that is shared must be safe against corruption if modified at any time by the ast. otherwise, the data must be guarded by blocking asts during critical sections. asts are most commonly encountered as a result of issuing qio calls to the kernel. completion of the i/o can be signalled by the issuance of an ast to the calling process/task. certain runtime errors could also be signalled using the ast mechanism. within openvms, special kernel-mode asts are used as the standard mechanism for getting access a process context; they are executed at the highest possible per-process priority the next time the scheduler makes that process current, and are used among other things for retrieving process-level information (in response to a $getjpi "getjob/process information" system call) and for performing process deletion. the following operating systems implement asts: * rsx-11 (including all of the variants) * rsts/e * openvms asts are roughly analogous to unix signals. the important differences are: * there are no "signal codes" assigned to asts: instead of assigning a handler to a signal code and raising that code, the ast is specified directly by its address. this allows any number of asts to be pending at once (subject to process quotas). * asts never abort any system call in progress. in fact, it is possible for a process to put itself into a "hibernate" state (with the $hiber system call), or to wait for an event flag by calling e.g. $waitfr, whereupon it does nothing but wait for asts to be delivered. when an ast is delivered (triggered by an io completion, timer, or other event), the process is temporarily taken out of the wait to execute the ast. after the ast procedure completes, the call that put the process into hibernation or the event flag wait is made again; in essence, the reason for the wait is re-evaluated. the only way to get out of this loop (apart from process deletion) is to execute a $wake or $setef system call to satisfy the wait. this can be done by the process itself by invoking $wake or $setef within the ast, or (if a global event flag is used) $setef within another process. v
OpenVMS Operating_system_technology