next up previous contents
Next: Protocols and Sessions Up: x-kernel Tutorial Previous: Contents

Object-Based Protocol Implementation

 

The x-kernel provides an object-based framework for implementing protocols, that is, the key abstractions of the x-kernel are represented by objects. An object may be conveniently thought of as a data structure with a collection of operations that are exported, that is, made available for invocation by other objects. Objects that have similar features are grouped into classes, with two obvious object classes for a protocol implementation environment being the protocol and the message.

To better understand the role played by the x-kernel, think of a protocol as an abstract object, one that exports both a service interface and a peer-to-peer interface. The former defines the operations by which other protocols on the same machine invoke the services of this protocol, while the latter defines the form and meaning of messages exchanged between peers (instances of the same protocol running on different machines) to implement this service. In a nutshell, the x-kernel provides a concrete representation for a protocol's service interface. While the protocol's specification defines what it means to send or receive a message using the protocol's service interface, the x-kernel defines the precise way in which these operations are invoked in a given system. For example, the x-kernel's operations for sending and receiving a message are xPush and xPop, respectively. An x-kernel protocol object would consist of an implementation of xPush and xPop that adheres to what the protocol specification says it means to send and receive messages using this protocol. In other words, the protocol specification defines the semantics of the service interface, while the x-kernel defines one possible syntax for that interface.

The fashionableness of object-based programming has been accompanied by a proliferation of object-oriented languages, of which C++ is probably the most well known example. The x-kernel, however, is written in C, which is not considered to be an object-oriented language. To deal with this, the x-kernel provides its own object infrastructure---the glue that makes it possible for one object to invoke an operation on another object. For example, when an object invokes the operation xOpen on some protocol p ( xOpen is the x-kernel operation for opening a communication channel) it includes p as one of the arguments to this operation. The x-kernel's object infrastructure takes care of invoking the actual procedure that implements this operation on protocol p. In other words, the x-kernel uses xOpen(p, ...) in place of the more conventional notation for invoking an operation on an object: p.xOpen(...).



next up previous contents
Next: Protocols and Sessions Up: x-kernel Tutorial Previous: Contents



Larry Peterson
Wed Feb 21 13:58:06 MST 1996