1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
<HTML>
<HEAD>
<TITLE>Package edu.rit.mp</TITLE>
</HEAD>
<BODY>
<P>
Package edu.rit.mp contains the Message Protocol (MP),
a transport layer protocol
for sending messages using TCP.
MP is intended
for use in message passing parallel programming
on cluster parallel computers.
<P>
<B>Operation</B>
<P>
A <B>source</B> process sends a message
to a <B>destination</B> process
through a <B>channel</B>.
Each message includes a <B>tag</B>;
this is just an integer that the source can use
to convey metadata to the destination.
Each message also includes a given number of <B>items</B>.
Each item in a message is of a given <B>type</B>
(the same type for all items in the message).
The supported types are given in the table below.
The table shows the Java type used to store the item in memory,
the number of bytes used to represent the item in a message,
and the range of values that can be represented.
<P>
For information on how to create channels
and send and receive messages,
see class <A HREF="ChannelGroup.html">ChannelGroup</A>.
<P>
<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=1>
<TR BGCOLOR="#E8E8E8">
<TD ALIGN="center" VALIGN="baseline"><I>Type</I></TD>
<TD ALIGN="center" VALIGN="baseline"><I>Stored As</I></TD>
<TD ALIGN="center" VALIGN="baseline"><I># of Bytes</I></TD>
<TD ALIGN="center" VALIGN="baseline"><I>Range</I></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Boolean</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>boolean</TT></TD>
<TD ALIGN="center" VALIGN="baseline">1</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>true</TT>, <TT>false</TT></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Byte</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>byte</TT></TD>
<TD ALIGN="center" VALIGN="baseline">1</TD>
<TD ALIGN="left" VALIGN="baseline">-128 .. 127</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Short</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>short</TT></TD>
<TD ALIGN="center" VALIGN="baseline">2</TD>
<TD ALIGN="left" VALIGN="baseline">-32768 .. 32767</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Integer</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>int</TT></TD>
<TD ALIGN="center" VALIGN="baseline">4</TD>
<TD ALIGN="left" VALIGN="baseline">-2147483648 .. 2147483647</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Signed 8-bit integer</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>int</TT></TD>
<TD ALIGN="center" VALIGN="baseline">1</TD>
<TD ALIGN="left" VALIGN="baseline">-128 .. 127</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Unsigned 8-bit integer</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>int</TT></TD>
<TD ALIGN="center" VALIGN="baseline">1</TD>
<TD ALIGN="left" VALIGN="baseline">0 .. 255</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Signed 16-bit integer</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>int</TT></TD>
<TD ALIGN="center" VALIGN="baseline">2</TD>
<TD ALIGN="left" VALIGN="baseline">-32768 .. 32767</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Unsigned 16-bit integer</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>int</TT></TD>
<TD ALIGN="center" VALIGN="baseline">2</TD>
<TD ALIGN="left" VALIGN="baseline">0 .. 65535</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Long</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>long</TT></TD>
<TD ALIGN="center" VALIGN="baseline">8</TD>
<TD ALIGN="left" VALIGN="baseline">-9223372036854775808 .. 9223372036854775807</TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Character</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>char</TT></TD>
<TD ALIGN="center" VALIGN="baseline">2</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>'\u0000'</TT> .. <TT>'\uFFFF'</TT></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Float</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>float</TT></TD>
<TD ALIGN="center" VALIGN="baseline">4</TD>
<TD ALIGN="left" VALIGN="baseline">Same as <TT>float</TT></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Double</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>double</TT></TD>
<TD ALIGN="center" VALIGN="baseline">8</TD>
<TD ALIGN="left" VALIGN="baseline">Same as <TT>double</TT></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="baseline">Object</TD>
<TD ALIGN="left" VALIGN="baseline"><TT>Object</TT></TD>
<TD ALIGN="center" VALIGN="baseline">Varies</TD>
<TD ALIGN="left" VALIGN="baseline"> </TD>
</TR>
</TABLE>
<P>
<B>Message Format</B>
<P>
A message consists of the following sequence of bytes:
<UL>
<LI>
A magic number, 30144596
(an integer, four bytes, MSB first).
<BR>
<LI>
The tag (an integer, four bytes, MSB first).
<BR>
<LI>
The type of item (one byte).
<BR>
<LI>
The number of items <I>N</I> (an integer, four bytes, MSB first).
<BR>
<LI>
The item values,
each item represented with the number of bytes
given in the above table.
For type = Object,
the item values are represented
as a sequence of bytes
consisting of <I>N</I> objects
serialized using Java Object Serialization.
</UL>
</BODY>
</HTML>
|