next up previous top
Next: SchedProcess
Up: Component Type
Previous: SeqFile

Process

Semantics

The component type Process is intended to capture the semantics of an independently scheduled process in the operating system environment. The type of process that it describes is different from a Unix filter in that it communicates with other processes, and does so via remote procedure calls.

A Process component can behave in one of two ways. It can behave like a "server" process, providing services to other processes by exporting remote procedure definitions, or it can behave like a "client" process, requesting services from other processes via remote procedure calls. The distinction between client processes and server processes is important in UniCon because certain properties (e.g., the EntryPoint property) have different semantics based on the kind of Process being defined. To formalize the definitions, a client process is one that exports no remote procedure definitions, only calls. A server process is one that exports at least one remote procedure definition. A process that exports remote procedure definitions and calls is still considered to be a server (i.e., one that requires services from other processes in order to accomplish its work).

Player types

Players of the following types can be legally exposed in the interface of a Process component:

an exported remote procedure or function definition
a call to a remote procedure or function exported by another process

Properties

The following properties can be legally included in the property list of a Process component. Properties legal in an <interface> property list have a C in parentheses after the property name; those legal in an <instantiation> property list have an I:

The syntax for an InstFormals property in a component of type
Process is a comma-separated list of <parameter>s enclosed in parentheses. A <parameter> consists of an <identifier>, followed by a `=', followed by a <complex string> or the language keyword NODEFAULT. A <complex string> is a simple "string" or a sequence of "string"s concatenated by the `&' character:

INSTFORMALS (first_parameter = "an initial value",
second_parameter = "a much" &
"longer initial value that " &
"will not fit on one line",
third_parameter = NODEFAULT)
The syntax for a Variant property in a component of type
Process is a single <identifier> or "string" surrounded by parentheses:

VARIANT (a_variant_name)
VARIANT ("a variant name")
The syntax for a Processor property in a component of type
Process is a single <identifier> or "string" surrounded by parentheses:

PROCESSOR (a_processor_name)
PROCESSOR ("a.processor.name")
The syntax for the EntryPoint property in a Process component is a single <identifier> or "string" surrounded by parentheses:

ENTRYPOINT (an_entrypoint_name)
ENTRYPOINT ("an entrypoint name")

If this property is omitted from the property list of the interface in a client Process component, the following default property is assumed:
ENTRYPOINT ("main")

If this property is omitted from the property list of the interface in a server Process component, no default is assumed.
The syntax for the InitRoutine property in a Process component is a single <identifier> or "string" surrounded by parentheses:

INITROUTINE (a_routine_name)
INITROUTINE ("a routine name")
The syntax for an RPCTypeDef property in a Process component consists of a sequence of three fields, all separated by semicolons, with the entire sequence enclosed in parentheses. The first field is an <identifier> or "string". The second field is also an <identifier> or "string". The third field is optional, and consists of a <size item> (if the third field is omitted, the semicolon following the second field is also omitted). A <size item> consists of an optional <array item>, followed by an
<integer>. An <array item> consists of one or more consecutive <array index>s of the form `[` <integer> `]':

RPCTYPEDEF (a_type_name; "another one")
RPCTYPEDEF (a_type_name; another_one; 32)
RPCTYPEDEF ("a type name"; another_one; [25] [16] 32)
The syntax for an RPCTypesIn property in a Process component is a comma-separated list of items, surrounded by parentheses, that are either <identifier>s or "string"s:

RPCTYPESIN ("an_include_file.h", "another_one.h")

Semantic Checks

A Process component that has a composite implementation may not contain an instantiation of a Process or a SchedProcess component.

Implementation Considerations

In UniCon, the "glue code" required for accomplishing remote procedure calls in the implementation is generated automatically by the UniCon compiler. Therefore, remote procedure definitions and calls in the source code implementation of a Process are implemented exactly like local procedure or function definitions and calls. The software engineer will not create any "glue code."

In addition to the static, compile-time "glue code," remote procedure calls require run-time support. Each process must perform some initialization in the environment before starting to perform its tasks. This initialization takes the form of looking up (client) or registering (server) services with a common "name server" process that executes in the environment. This is how client processes are able to locate services provided by server processes in the run-time environment. The UniCon compiler generates this run-time initialization code automatically for each process. It generates a "main" program that performs the initialization and calls the initial entrypoint in the source code provided by the system designer. The designer specifies this entrypoint name using the EntryPoint property.

The source code implementation of a client process must be a function or a procedure.
UniCon currently only supports implementations in the C programming language, so for now it must be a C function. The function can be named "main," however it will be renamed in this case since UniCon produces a "main" function for each process. The "main" function that UniCon produces performs any initialization required to support remote procedure calls between this and other processes, and then it calls the function that implements the client process. The process terminates when this function returns, so some sort of infinite processing (i.e., loop) may be required to keep the process active.

The source code implementation of a server process is different. It must be a collection of C functions, called service functions, plus optionally one additional worker function. The worker function, if present, will run in parallel with a UniCon-generated "main" program. It performs application-specific processing. The service functions become the callable remote procedures at run-time. UniCon generates a "main" function that performs initialization required to support remote procedure calls between this and other processes and loops forever waiting for service requests from other processes. This main function will call the appropriate service function to perform a requested service, and then send the results back to the client process that made the request.

The worker function must be implemented as a simple C function. Under Mach, the worker function may or may not loop forever. In RPCGen-based servers, the worker thread must not loop forever, and will be called periodically (after performing each service request, and every 10 milliseconds if no requests are forthcoming). The presence or absence of a worker function is specified by the presence or absence of the EntryPoint property in the interface property list of a server Process component. The name of the worker function is supplied as the value of this property.

Each service function must be a simple C function that does not loop forever, but rather eventually returns.

One final note: remote procedure calls on Mach systems require that the functions pass results back to client processes via the arguments of the function (i.e., the return value is passed back to the caller by modifying the location pointed to by one of the input arguments), rather than as the return value of the function. This is not the case for RPCGen-based services.


next up previous top
Next: SchedProcess
Up: Component Type
Previous: SeqFile

Comments? Mail the current maintainer of this page.

Author: Gregory Zelesnik

Last Modified: May 12, 1996