## 3 The SOMM Model
### Achieving Flexibility via Virtual Machine
#### 3.3.4 Tuple Space  
SOMM provides a tuple space on each node. A tuple space is a virtual repository or buffer that can contain tuples. The tuple space serves as an associative memory, in that tuples in the tuple space can be accessed by matching some or all the elements of the tuples to values or types presented in a template, which is simply a tuple set up for this matching.  
* <wsdl:definitionstargetNamespace=\"[[http://sbu.ac.ir/vstream/](http://sbu.ac.ir/vstream/)]([http://sbu.ac.ir/vstream/](http://sbu.ac.ir/vstream/))\"> <wsdl:types>  <xsd:schema>  <xs:elementname=\"request\">  <xs:complexType>  <xs:attributename=\"method\" type=\"xs:string\" use=\"required\"/>  <xs:attributename=\"stream_id\" type=\"xs:integer\" />  <xs:attributename=\"QoS\" type=\"xs:integer\" />  </xs:complexType>  </xs:element>  <xs:elementname=\"response\">  <xs:complexType>  <xs:sequence>  <xs:elementname=\"vstream\" type=\"xs:stream\"/>  </xs:sequence>  </xs:complexType>  </xs:element>  <xs:elementname=\"status\">  <xs:complexType>  <xs:sequence>  <xs:elementname=\"msg\" type=\"xs:string\"/>  </xs:sequence>  </xs:complexType>  </xs:element>  </xs:schema>  </wsdl:types>  <interfacename=\"vstream_interface\">  <fault name=\"ServerError\" element=\"tns:status\"/>  <operationname=\"start\" >  <input messageLabel=\"In\" element=\"tns:request\"/>  <output messageLabel=\"Out\" element=\"tns:response\"/>  </operation>  <operationname=\"stop\" >  <input messageLabel=\"In\" element=\"tns:request\"/>  <output messageLabel=\"Out\" element=\"tns:status\"/>  </operation>  <operationname=\"pause\" >  <input messageLabel=\"In\" element=\"tns:request\"/>  <output messageLabel=\"Out\" element=\"tns:status\"/>  </operation>  </interface>  <wsdl:service  name=\"simple_vstream\"  type=\"vstream\"  endpoint=\"a4-3\"  interface=\"tns:vstream_Interface\"  QosMin = \"3\"  QosMax = \"7\"/>  </wsdl:definitions>  
Figure 4: Service description for a simple video streaming service.  
The concept of a tuple space was first described in 1982 in a programming language called Linda [25]. The basic idea is to have many active programs distributed over physically dispersed machines, unaware of others existence, and yet still able to communicate. They communicate to each other by releasing data (a tuple) into tuple space. Figure 5 shows a symbolic tuple space. Programs read, write, and take tuples from tuple space that are of interest to them. In general, a tuple captures the intuitive notion of an ordered list of elements like (120, 17, 8) or (\"book\", \"abcd\", \"mo\", \"pp\") or (\"John\", 85, 15.7) which is accessed via pattern matching.  
There are some other middlewares which proposed the using of tuple space in a WSN [26, 27]. TinyLime [27] proposed a mechanism for communication between applications in different nodes of network using tuple space. In this approach, the tuple spaces of direct or indirect neighbor nodes are integrated and form a global tuple space. If an application in node A puts a tuple in its tuple space, applications in other nodes which share neighborhood with A can access that tuple. TeenyLime [26] also suggested a similar tuple space except that tuple spaces are only shared between nodes that are direct neighbors. However, since sharing tuple spaces between nodes of network imposes communication overhead, tuple spaces in SOMM are only accessible locally and agents can only access local tuple space. SOMM supports standard tuple space operations. An agent can add a tuple to local tuple space using an _out_ command. The command _in_ removes and returns a matched tuple from local tuple space. The _rd_ command is similar to _in_, except that it does not remove the matched tuple from tuple space and only returns it to the caller agent.