A continuation based runtime typically executes activities or programs. An activity typically represents a unit of executable code consisting of multiple pulses of work. One manner in which an activity can execute multiple pulses of work is through the scheduling of child activities. Such a composition of activities typically enables custom control flows that can be implemented through the scheduling of child activities zero or more times as determined by the composite activity. An activity can also setup a resumable continuation or bookmark in its execution that is resumed by a stimulus external to the runtime. The runtime interprets this external stimulus as another pulse of work to be handled by the activity. Pulses of work are typically represented as continuations that the runtime invokes on activities (thus, continuation based runtime). Beyond the flexibility to create new control flows and handle external resumptions, activities generally include the following characteristics: they have no process affinity—they can be paused and resumed in a different process; they have no thread affinity—different pulses of work can run on different threads; they can be persisted and rehydrated.
Dealing with external stimuli can present several complications. For example, multiple stimuli can occur simultaneously. In general, a continuation based runtime processes stimuli as they arrive. A continuation based runtime should be capable of predictably managing multiple external stimuli relative to internal state. Such management is typically performed by assessing validity of the stimulus either for immediate processing or by determining that the activity will never enter a state wherein the stimulus is valid. Such management typically results in a program's ability to accept or reject a stimulus. But it may be desirable to further determine if the stimulus may be valid for processing at a later point in the activity.
The following presents a simplified summary of the disclosure in order to provide a basic understanding to the reader. This summary is not an extensive overview of the disclosure and it does not identify key/critical elements of the invention or delineate the scope of the invention. Its sole purpose is to present some concepts disclosed herein in a simplified form as a prelude to the more detailed description that is presented later.
The present examples provide technologies for enabling a continuation based runtime to accept or reject external stimulus and, in addition, to determine if an external stimulus may be valid for processing at a later point in execution.
Many of the attendant features will be more readily appreciated as the same become better understood by reference to the following detailed description considered in connection with the accompanying drawings.
The present description will be better understood from the following detailed description considered in connection with the accompanying drawings, wherein:
Like reference numerals are used to designate like parts in the accompanying drawings.
The detailed description provided below in connection with the accompanying drawings is intended as a description of the present examples and is not intended to represent the only forms in which the present examples may be constructed or utilized. The description sets forth at least some of the functions of the examples and/or the sequence of steps for constructing and operating examples. However, the same or equivalent functions and sequences may be accomplished by different examples.
Although the present examples are described and illustrated herein as being implemented in a computing and networking environment, the environment described is provided as an example and not a limitation. As those skilled in the art will appreciate, the present examples are suitable for application in a variety of different types of computing and networking environments.
In one example, CBR 110 supports at least two different types of continuations: conversation continuations and non-conversation continuations. A conversation continuation (“CContinuation”) is generally a continuation associated with a conversation between an activity, such as activity 120, and some external party or service, such as service 140. Such a conversation may make use of any suitable protocol and may take place over any span of time, short or long, even over a period of years. In general, an activity (or child activity) may send a message to another party, the message eliciting a responsive message in return. The responsive message may take some time, short or long, even up to several years, to arrive. After sending the initial message, the activity typically creates a CContinuation and then ceases execution while waiting for the response, thus allowing other activities or child activities to be executed or further executed by the CBR. A responsive message typically comprises a request to resume the CContinuation. If the responsive message and/or request to resume are valid, then CBR 110 typically provides the responsive message to activity 120 and executes the CContinuation, thus continuing execution of the activity with the responsive message it was waiting for starting at the point that it ceased execution.
A non-conversation continuation (“NCContinuation”) is generally a continuation controlled by an activity or child activity itself when performing some form of external asynchronous (blocking) operation. Requests to resume a NCContinuation generally come from the same activity or child activity that created the NCContinuation as opposed to another party. For example, an activity may request that some information be written to a database, an operation that may take some time, short or long. Once such an operation is complete or the like, a status message of any suitable form is typically returned. Upon receipt of such a status message, activity 120 typically makes a request to resume the NCContinuation corresponding to the status message and CBR 110 continues execution of the activity with the status message it was waiting for starting at the point that it ceased execution.
Continuation list 114 typically contains a list of active continuations such as CContinuations and NCContinuations after they have been created and at least until that have been executed or canceled or the like. Such a list may include additional information about each continuation such as its type (conversation, non-conversation, etc), an identifier (“ID”) for the activity or child activity it is associated with, an ID for the conversation it is associated with, a list of governing continuations, etc. In one example, a governing continuation is a continuation on which another continuation is dependent before it can continue execution—that is, a governing continuation must be executed before the continuation is depends on can execute.
Stability calculator 112 typically determines if a request to resume a CContinuation can be immediately accepted, or accepted at a later point in execution, or if it can be immediately rejected. The method for making this determination is described herein below in connection with
Example activity 120 shows a sequence of three child activities. First, WriteDB 122 provides some information to be written into DB 130. Second, Receive Message A 124 expects to receive a Message A as part of a conversation from Service A. Third, Receive Message B expects to receive a Message B as part of a conversation from some other external party. Not shown, both Message A and Message B are part of the same conversation (i.e., are associated with the same conversation ID). In one example, a default conversation ID is associated with all conversations unless otherwise specified.
Activity 120 is a simplified example that may be executed in CBR 110, which may operate in a computing environment such as that described in connection with
Step (1) shows WriteDB 122 starting an asynchronous operation to write some information to DB 130. Step (2) shows WriteDB 122 creating an NCContinuation for the asynchronous operation and waiting until a status message is returned from DB 130 indicating the completion status of the requested asynchronous operation. Step (3) shows a request to resume CContinuation for Message A (for conversation ID=n) from Service A 140. Note that no CContinuation for Message A has been created to resume at this point in the execution. Step (4) shows stability calculator 112 checking conversation n for stability as described herein below. Since conversation n is unstable, the request to resume the CContinuation for Message A may be accepted at a later point in execution. Step (5) shows DB 130 returning the status message regarding the asynchronous operation. Step (6) shows WriteDB 122 requesting to resume the NCContinuation associated with the asynchronous operation. Step (7) shows CBR 110 continuing execution of WriteDB 122 responsive to the request to resume. Step (8) shows Receive Message A creating a CContinuation for Message A (conversation ID=n); activity 120 then ceases execution. Step (9) shows stability calculator 112 again checking conversation n for stability as described herein below. Since conversation n is now stable, the request to resume CContinuation for Message A from step (3) may be immediately accepted. Step (10) shows execution of Receive Message A 124 being resumed. Step (11) shows a return of “successful” responsive to the request to resume of step (3).
Block 210 typically indicates checking to see if the CContinuation exists. In one example, this includes checking a continuation list, such as list 114 of
Block 220 typically indicates accepting request 202 and immediately resuming the CContinuation responsive to request 202. In one example, this includes continuing or resuming execution of the activity or child activity that created the CContinuation. This may also including providing information to the activity or child activity from the external party requesting the resumption of the CContinuation, examples of information including, but not limited to, a message or status message or the like including any data suitable to the conversation. Once the CContinuation has been resumed, method 200 is typically complete.
Block 230 typically indicates determining if the conversation associated with the CContinuation is stable. An example method for checking stability is described in connection with
Block 240 typically indicates rejecting request 202 to resume the CContinuation. This typically includes returning a “failed” message or the like to the party submitting request 202. In this case, there is no CContinuation currently in existence corresponding to request 202 and the conversation associated with request 202 is considered stable (or the conversation associated with request 202 is currently unknown by the means of performing method 200). Note that a CContinuation matches a request if the CContinuation ID of the CContinuation and request match and the associated conversation ID of the CContinuation and request match. Accordingly, in this case no corresponding CContinuation currently exists to resume so a failure message is returned. Once the failure message is returned, method 200 is typically complete.
Block 250 typically indicates determining if a timeout period has expired. This typically includes determining if a particular amount of time has transpired since request 202 has arrived and has not been either accepted or failed. The particular amount of time may be short or long. If there is still time remaining to accept or reject request 202 then method 200 typically continues at block 270. Otherwise, method 200 typically continues at block 260.
Block 260 typically indicates request 202 being timed-out. This typically includes rejecting request 202 and retuning a “timeout” message or the like to the party submitting request 202. In this case there is no CContinuation currently in existence corresponding to request 202 and the conversation associated with request 202 is not considered stable. Once the timeout message is returned, method 200 is typically complete.
Block 270 typically indicates delaying a determination to accept or reject request 202 until a future point in the execution of the corresponding activity or child activity. The delay may end after a specified period of time, short or long, or may end after the creation of a matching CContinuation. Once the delay end, method 200 typically continues at block 210.
Block 310 typically indicates determining if any NCContinuations currently exist in the context of the activity (e.g., activity ID=b). If any such NCContinuations do exist, then the conversation is considered unstable. If the conversation is considered unstable, then method 300 typically returns an unstable indicator 330. Otherwise, method 330 typically continues at block 320.
Block 320 typically indicates determining if any governing continuations exist that are associated with the CContinuation of interest. If any such governing continuations do exist, then the conversation is considered unstable. If the conversation is considered unstable, then method 300 typically returns an unstable indicator 330. Otherwise, method 330 typically returns a stable indicator 340.
Computing environment 400 typically includes a general-purpose computing system in the form of a computing device 401 coupled to various components, such as peripheral devices 402, 403, 404 and the like. System 400 may couple to various other components, such as input devices 403, including voice recognition, touch pads, buttons, keyboards and/or pointing devices, such as a mouse or trackball, via one or more input/output (“I/O”) interfaces 412. The components of computing device 401 may include one or more processors (including central processing units (“CPU”), graphics processing units (“GPU”), microprocessors (“μP”), and the like) 407, system memory 409, and a system bus 408 that typically couples the various components. Processor 407 typically processes or executes various computer-executable instructions to control the operation of computing device 401 and to communicate with other electronic and/or computing devices, systems or environment (not shown) via various communications connections such as a network connection 414 or the like. System bus 408 represents any number of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a serial bus, an accelerated graphics port, a processor or local bus using any of a variety of bus architectures, and the like.
System memory 409 may include computer readable media in the form of volatile memory, such as random access memory (“RAM”), and/or non-volatile memory, such as read only memory (“ROM”) or flash memory (“FLASH”). A basic input/output system (“BIOS”) may be stored in non-volatile or the like. System memory 409 typically stores data, computer-executable instructions and/or program modules comprising computer-executable instructions that are immediately accessible to and/or presently operated on by one or more of the processors 407.
Mass storage devices 404 and 410 may be coupled to computing device 401 or incorporated into computing device 401 via coupling to the system bus. Such mass storage devices 404 and 410 may include non-volatile RAM, a magnetic disk drive which reads from and/or writes to a removable, non-volatile magnetic disk (e.g., a “floppy disk”) 405, and/or an optical disk drive that reads from and/or writes to a non-volatile optical disk such as a CD ROM, DVD ROM 406. Alternatively, a mass storage device, such as hard disk 410, may include non-removable storage medium. Other mass storage devices may include memory cards, memory sticks, tape storage devices, and the like.
Any number of computer programs, files, data structures, and the like may be stored in mass storage 410, other storage devices 404, 405, 406 and system memory 409 (typically limited by available space) including, by way of example and not limitation, operating systems, application programs, data files, directory structures, computer-executable instructions, and the like.
Output components or devices, such as display device 402, may be coupled to computing device 401, typically via an interface such as a display adapter 411. Output device 402 may be a liquid crystal display (“LCD”). Other example output devices may include printers, audio outputs, voice outputs, cathode ray tube (“CRT”) displays, tactile devices or other sensory output mechanisms, or the like. Output devices may enable computing device 401 to interact with human operators or other machines, systems, computing environments, or the like. A user may interface with computing environment 400 via any number of different I/O devices 403 such as a touch pad, buttons, keyboard, mouse, joystick, game pad, data port, and the like. These and other I/O devices may be coupled to processor 407 via I/O interfaces 412 which may be coupled to system bus 408, and/or may be coupled by other interfaces and bus structures, such as a parallel port, game port, universal serial bus (“USB”), fire wire, infrared (“IR”) port, and the like.
Computing device 401 may operate in a networked environment via communications connections to one or more remote computing devices through one or more cellular networks, wireless networks, local area networks (“LAN”), wide area networks (“WAN”), storage area networks (“SAN”), the Internet, radio links, optical links and the like. Computing device 401 may be coupled to a network via network adapter 413 or the like, or, alternatively, via a modem, digital subscriber line (“DSL”) link, integrated services digital network (“ISDN”) link, Internet link, wireless link, or the like.
Communications connection 414, such as a network connection, typically provides a coupling to communications media, such as a network. Communications media typically provide computer-readable and computer-executable instructions, data structures, files, program modules and other data using a modulated data signal, such as a carrier wave or other transport mechanism. The term “modulated data signal” typically means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communications media may include wired media, such as a wired network or direct-wired connection or the like, and wireless media, such as acoustic, radio frequency, infrared, or other wireless communications mechanisms.
Power source 490, such as a battery or a power supply, typically provides power for portions or all of computing environment 400. In the case of the computing environment 400 being a mobile device or portable device or the like, power source 490 may be a battery. Alternatively, in the case computing environment 400 is a desktop computer or server or the like, power source 490 may be a power supply designed to connect to an alternating current (“AC”) source, such as via a wall outlet.
Some mobile devices may not include many of the components described in connection with
Those skilled in the art will realize that storage devices utilized to provide computer-readable and computer-executable instructions and data can be distributed over a network. For example, a remote computer or storage device may store computer-readable and computer-executable instructions in the form of software applications and data. A local computer may access the remote computer or storage device via the network and download part or all of a software application or data and may execute any computer-executable instructions. Alternatively, the local computer may download pieces of the software or data as needed, or distributively process the software by executing some of the instructions at the local computer and some at remote computers and/or devices.
Those skilled in the art will also realize that, by utilizing conventional techniques, all or portions of the software's computer-executable instructions may be carried out by a dedicated electronic circuit such as a digital signal processor (“DSP”), programmable logic array (“PLA”), discrete circuits, and the like. The term “electronic apparatus” may include computing devices or consumer electronic devices comprising any software, firmware or the like, or electronic devices or circuits comprising no software, firmware or the like.
The term “firmware” typically refers to executable instructions, code, data, applications, programs, or the like maintained in an electronic device such as a ROM. The term “software” generally refers to executable instructions, code, data, applications, programs, or the like maintained in or on any form of computer-readable media. The term “computer-readable media” typically refers to system memory, storage devices and their associated media, and the like.
In view of the many possible embodiments to which the principles of the present invention and the forgoing examples may be applied, it should be recognized that the examples described herein are meant to be illustrative only and should not be taken as limiting the scope of the present invention. Therefore, the invention as described herein contemplates all such embodiments as may come within the scope of the following claims and any equivalents thereto.