22: Understanding Process Fundamentals
- Processes populate the telesphere with life
- A process is an autonomous executing object
- The Process class is abstract and has two abstract subclasses: Place and Agent. All processes are either places or agents.
- The Process class uses three mix-ins created specifically for processes:
- Named, which provides a telename (discussed later) for each process
- PackageProcess, which allows each process to use packages (described later) for shared information
- PermitProcess, which assigns permits (described later) to each process, controlling the process's behavior
- Processes can run simultaneously on a Telescript engine (preemptive multitasking)
- Identifying a Process
- Processes are differentiated by telenames.
- A telename is assigned by the engine whenever a process is constructed; the telename can't be falsified.
- The telename is kept in the name attribute of the process (through the Named mix-in)
- A telename has two attributes:
- The authority (described in detail later)
- Identifies the entity responsible for the construction and activities of this process.
- Is copied from the process responsible for construction of this process.
- Is an engine-computed octet string that distinguishes this authority from all other authorities no matter when or where created.
- A telename must have an authority.
- The identity
- Identifies the process as a unique entity within the authority.
- Is an engine-computed octet string that distinguishes this process from all others of the same authority no matter when or where they were created.
- Identity is optional in a telename.
- Telenames are used when one process wants to specify another process, but doesn't have a reference to the second process--for example, when an agent wants to meet with another agent.
- A telename that has an authority but no identity (called an advanced telename) identifies all processes of that authority. It is a very general identity, especially in a place where there are many processes of the same authority
- A telename that has both an authority and an identity is called an assigned telename. It identifies a single process.
- Two processes that share the same authority are peers. Their telenames, which share the same authority, are also peers.
- Using global variables
- A global variable is a Telescript keyword that a requester may use in place of an object identifier in an operation request. The Telescript engine replaces the selector with a reference to the appropriate object at the time the operation is requested.
- Global variables are useful for agents and places that need references to currrently meaningful objects.
- Global variables provided by Telescript are:
- self or *: specifies the operation's responder
- client: specifies the operation's requester
- process: specifies the current process (the process currently being executed--see the chapter on multitasking)
- here: specifies the current process's place of occupancy
- place: specifies the current process if it's a place; otherwise specifies the current process's place of occupancy.
- owner: specifies the current owner (ownership is discussed in the ownership chapter)
- sponsor: specifies the current sponsor of execution (sponsorship is discussed in the multitasking chapter)
- Permits (a sketchy overview)
- Every process's activities are governed by permits.
- Permits restrict a process's activities so they aren't harmful or don't consume too many resources.
- Permits limit a process's age, size, and ability to perform different actions, among other things.
- A process is issued different permits that restrict its behavior. Some of these permits (and the capabilities they restrict) may change if the process changes location.
- The process receives permits on initialization.
- Permits are stored in the attributes of the PermitProcess mix-in used to define the Process class.
- The process, if it moves from place to place (that is, it's an agent), may receive new permits when it arrives at a new location.
- A process may also receive temporary permits when it executes a specially designated block of code.
- The process's behavior is governed by the combination of all of its permits, restricting the process to only capabilities allowed by all the permits.
- The life of a process
- A process goes through three stages of life.
- Construction by the engine when another process instantiates a process class
- Construction is performed when the engine calls "initialize" on the process.
- Living, which is the execution--immediately after construction--of the process's live method
- Every process must have a live operation.
- The live operation can only be called by the engine.
- Termination by the engine
- A process is terminated on construction if an exception is thrown.
- A process is terminated while executing the live method if an exception is thrown. (Note that the process may have permission (via permit) to be restarted. If so, the engine restarts the live operation using the thrown exception as the argument.)
- A process is terminated if its permit runs out.
- A process is terminated if its live method ends.
- Process persistence
- The state of a process is periodically backed up by the engine.
- If the engine fails, the process is unavailable until the engine resumes operation.
- The process is restored to its last saved state when the engine resumes, and the process resumes execution.
- Process interaction
- One process can work directly with another process by requesting operations on the second process.
- Operation arguments and results allow processes to trade objects back and forth. They can do so by reference, by copy, or by changing ownership.
- Processes can only interact if one process has a reference to the other process, which is not always the case.
- When one process (the requester) calls an operation on a second process (the responder), the operation may sponsored by the second process.
- A sponsored operation executes under the authority (discussed later) of the responder.
- If the operation is not declared a sponsored operation, it executes under the authority of the requester.
- Operation boundaries
- An operation called on another process is a foreign operation to the requester.
- An operation called by a process on itself or a nonprocess object is a domestic operation.
- Processes can also interact using other Telescript mechanisms: packages, events, and resources (all described in later chapters of their own).
- These mechanisms provide multicast communication so one process can communicate with many other processes simultaneously.
TS Ref - 26 JUN 1996
Generated by the sweat of Mike Boom's brow.