Broadcasting

Kyle Lahnakoski kyle@arcavia.com
Sun, 02 Apr 2000 01:35:15 -0500


<preamble>

One thing that I have noticed about myself is that I will speak as if I
am talking of implementation.  I am not.  I usually talk in terms of an
apparent model.  This model, technically, has nothing to do with
implementation.  The reflective system I am building can convert between
the model I speak in, and the implementation.  Consider below where I
mention that "Each object has a message queue."  That does not really
happen.  Right now, for ease, I have made my compiler build single
threaded applications. Therefore a message passed from one object to
another is executed immediately and returned, removing the need for a
queue.  You may have also noticed when talking on "Re: Lists, Tables,
Psets ..." I did not distinguish between the name of a parameter and its
ID; in any one context, the name is always constant and therefore 1-1
with ID.  


Function instances (also called Messaging State Machines) are objects
that are executable.  In C a function instance is the stack space a
function would use and the space taken for temporary variables.  It
would not include the executable code, that is a "function"  Please see
http://www.arcavia.com/rd/dbc-html/Function.html for a better
explanation.

Function instances, in DBOS, have a single context variable.  A context
variable is much like a stack except it has a maximum and minimum size
of one.  I can not seem to get rid of the context variable.  This does
not bother me anymore.

Function interfaces do not have a textual representation in the DBOS. 
They could, but I am lazy, I use my SITH application to create the
structures that describe the function interface.  For the purposes of
email I have a textual representation of function interfaces; i have
chosen the Java/C/C++ method:

<return type> <function name><(>(<parameter type> <parameter
name>)*<)><;>

Where <(>, <)>, <;> are terminals.

</preamble>

Broadcasting:  What is it?  How should it be modeled?

Consider yourself an object.  Currently, to get work done, you send
messages to other objects.  Semantically, I chose:

	destination Object.MyMessage(Name="Kyle", Age=26);

Each object has a message queue, and messages can be blocking or non
blocking. There is no semantic model to distinguish the two yet.

There are two cases of broadcasting.  The first is a traditional model,
where objects "listen" to the broadcast messages you emit.  Currently,
the logical model is to make a message that has no destination object. 
Semantically:

	.MyMessage(Name="Kyle", Age=26);

The second case of broadcasting is where a request to execute an atomic
instruction is made.  Logically, I do not know what to think.  It could
be just like the former broadcast: assuming there is only one listener
to give an answer.  Semantically I do the following:

	MyMessage(Name="Kyle", Age=26);

An atomic instructions are things like:

//GetValue: take the variable, object.field, and set the context
//variable to its value.
Object_Class GetValue(Object_Class object, Field_Class field)

//SetValue: take the context variable and put the value into
object.field.
Object_Class SetValue(Object_Class object, Field_Class field)

//Add_Integer: add two integers, put result on context var
Integer_Class Add_Integer(Integer_Class Value1, Integer_Class Value2)

//Compare_Integer: compare two integers put result on context var
{Greater, Lesser, Equal} Compare_Integer(Integer_Class Value1,
Integer_Class Value2)

The last example has an unnamed return type; one of Greater, Lesser or
Equal.

You can see these are fundamental instructions that require a processor
to do.  Generally speaking: the situation where an object "talks" to a
single unknown "listener" can happen in many cases where work needs to
be done, and the definition of that work is globally accessible.  The
"talker" does not care what object does the work, just that the work is
done.

Thank you.
-- 
----------------------------------------------------------------------
Kyle Lahnakoski                                  Arcavia Software Ltd.
(416) 892-7784                                 http://www.arcavia.com