The PTS Programming Model is very simple
and straightforward. It's a distributed application and in
the distributed application, there are threads and
channels. These are the two high level abstractions
provided in the programming model. And the
computation graph that you generate using the PTS
programming model, in particular the extractions thread
and channel provided with the PTS programming model.
The computation graph looks very similar to a UNIX process socket graph.
So in terms of a transition for a programmer that is familiar with the
socket API. To transition to programming,
using the abstractions provided by PTS, is
not significant. While the computation graph
looks similar to a process socket graph,
the semantics of the channel abstraction is
very different from the socket abstraction. In
particular, what the channel holds are time
sequenced data objects. So a thread is generating
time sequence data objects can place those
time sequence data objects into the channel.
The other thing you will also notice
from the structure of this computation graph that
there could be multiple producers of data that go into a given channel And
similarly, there could be multiple consumers of
data that are getting data from a given
channel. Or, in other words, a channel allows many to many connections. A thread
that produces some data and wants to put it into a channel uses the primitive
provided for. Operating on the channel, namely the
put item primitive and the put item takes two
arguments, one is the item itself, which is
whatever the application decides as the content of the
data that it wants to put in the
channel. The time stamp that it can associate with
the data that it is producing and placing in
the channel. So if you look at the contents
of any given channel, it's really showing a temporal evolution of data that is
being produced by a particular thread. For
example, this thread could be capturing data from
a camera and every item that it produces is one frame of image captured from
the camera associated with the wall clock
time. At which that particular frame was captured.
A computation that is needing to use the data will do a get on a channel and
when it does a get on a channel it actually has to specify two arguments. One is
a lower bound for a time stamp that it is looking for and an upper bound. Or
in other words a thread that wishes to
get data from this channel, for instance, will specify
in the get primitive that I want to get the data that is in a particular channel
starting at a particular time. Say 1:05 p.m., To an upper bound, 1:06
p.m. And what the thread is going to get back is all the items that this
channel contains between this lower bound and upper
bound. The programming model also allows an application
to specify time variables in an abstract way. It could say, I want the oldest
item from a channel, or the newest item from the channel. In addition
to specifying explicit lower bound and upper bound markers if it so chooses.
So in other words, a channel contains a continuous stream of data that have been
snapshotted with different time stamps associated with them. So, this is the way
one could write a program that uses the primitives provided by the PTS
programming model. Let's say we are writing the code for a detector
that is looking at video stream produced by a particular camera. In that case,
the detector will associate a variable channel one with
the video stream that corresponds to what that camera's producing.
And continuously what it is going to do is, it
is going to get a camera image from that particular channel. And
it might specify a lower bound and an upper bound in terms of time that it is
looking for. Process the data, produce an output, and it might place the output.
That it produced as a digest of information that it processed into another
channel, and it'll do that by putting the digest as a new item, and
associate a time stamp. This is a place where the programming model facilitates.
Temporal causality to be propagated in the
distributed system. So if this thread is
a detector thread that is looking at
the camera images produced by a camera thread,
then it can take the camera images, process it. And place it in its
output channel, and when it places it in the output channel, it can use the same
time stamp that it got for an input image in doing the put
operation, and that way, there is simple
causality that is being propagated through this
graph by the computation using the primitive that
is available from this PTS programming system. Quite often in
situation awareness application, the computation may have to use data
from several different streams in order to
do its high-level inferencing. So a particular thread
may get information from several different streams,
and it may have to make high level
inference based on the composite results that
it is getting from all these schemes. And
since all the data that is coming from
the channels have time stamps associated with them,
an intermediate computation like this that is
taking multiple streams and generating a high
level inference from it, can use the time stamps in the incoming streams to see
which data items in these streams are
temporally correlated with one another. And use that
information to improve the kind of inferencing
and hypothesis that can be derived in the
situation awareness application. So in a
nutshell, the PTS programming model, what it
allows, is the ability to associate time stamp with data items produced by
a computation. So the model allows propagation of temporal causality because the
fact that a computation can associate a time stamp with an item that it produces
based on the time stamp that it got. On the data that it obtained
from its input channel and thirdly the fact that every stream is temporally
indexed allows a computation to correlate
the incoming streams. And recognize which data
items in the input streams are temporally related to one another by looking at
the time stamps associated with the items
that it is fetching from the different channels.