<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- MUX.html   (C) K. J. Turner        18/12/14  -->

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

  <title>Multiplexer</title>

  <link rev="made" href="http://www.cs.stir.ac.uk/~kjt/"/>

  <script type="text/javascript" language="JavaScript">
<!--
  var simulator;
  var serviceCount;
  var serviceMode;

  function valid(count, mode, overwrite) {
    if (!count.match("\\d+") || count < 1 || count > 5) {
      alert ("Source/sink count " + count + " must be in range 0-5");
      return false;
    }
    else
      return true;
  }

  function set() {
    serviceCount = document.settings.serviceCount.value.toString();
    serviceMode = document.settings.serviceMode.checked;
    serviceOverwrite = document.settings.serviceOverwrite.checked;
    if (valid(serviceCount, serviceMode, serviceOverwrite)) {
      simulator.setParameter("serviceCount", serviceCount);
      simulator.setParameter("serviceMode", serviceMode);
      simulator.setParameter("serviceOverwrite", serviceOverwrite);
      simulator.restart();
    }
  }
//-->
  </script>

</head>

<body background="simulator.jpeg"
 onload="simulator=document.ProtocolSimulator; set();">

  <div style="text-align: center">

    <h1>Multiplexer</h1>

    <img src="simulator.gif" alt="Simulator Logo"/>

  </div>

  <h2>Protocol Description</h2>

  <p>
    MUX (Multiplexer) illustrates how data can be multiplexed among multiple
    sources and sinks via a shared communications channel. Each source
    independently sends data indexed by its number to the corresponding sink
    with the same number. At the source end, a multiplexer combines data from
    the sources and sends it over a shared channel. At the sink end, a
    demultiplexer splits the incoming channel data and sends it to the
    corresponding sinks.
  </p>

  <center>

    <img src="multiplexer.gif" alt="Multiplexer Illustration"/>

  </center>

  <p>
    For this simulation, the communications channel is assumed to operate
    perfectly (no message corruption, loss or misordering). When the multiplexer
    sends a message, it therefore arrives directlyat the demultiplexer. It
    follows that acknowledgements, sequence number and timeouts are not
    applicable.
  </p>

  <p>
    The multiplexer and demultiplexer exchange messages in a format that depends
    on the kind of multiplexing:
  </p>

  <ul>

    <li>
      <p>
	For synchronous multiplexing, the multiplexer periodically sends all
	available data in a format such as <var>DT(D8,D4,...)</var>; this means
	that source <var>0</var> is sending data <var>D8</var>, source
	<var>1</var> is sending data <var>D4</var>, etc. If a source has not
	supplied data before the multiplexer has sent a message, this is shown
	as '-' (e.g. <var>DT(-,D4)</var> for data from source <var>1</var>
	only).
      </p>
    </li>

    <li>
      <p>
	For asynchronous multiplexing, the multiplexer sends individual source
	data as it arrives in a format such as <var>DT(2,D6)</var>; this means
	that source <var>2</var> is sending data <var>D6</var>.
      </p>
    </li>

  </ul>

  <p>
    Perfect multiplexing would always operate faster than sources supply data
    and sinks consume it. As an option, the simulation can allow multiplexing to
    be slower than this. The result is that new data can overwrite data that has
    been previously stored but not yet delivered.
  </p>

  <h2>Protocol Parameters</h2>

  <p>
    By default, multiplexing uses 2 sources/sinks, is synchronous, and does not
    overwrite previous data. You can modify the way in which the protocol works
    by modifying these settings (e.g. 1 to 5 sources/sinks). Click Change
    Settings after making these alterations. This will restart the whole
    simulation.
  </p>

  <form name="settings">

    <center>

      <table cellspacing="5">

	<tr>
	  <td align="right">Number of Sources/Sinks:</td>
	  <td><input name="serviceCount" size="4" value="2"></td>
	  <td align="right">Asynchronous Multiplexing:</td>
	  <td align="left"><input type="checkbox" name="serviceMode"></td>
	  <td align="right">Data Overwriting:</td>
	  <td align="left"><input type="checkbox" name="serviceOverwrite"></td>
	</tr>

	<tr>
	  <td align="center" colspan="6">
	    <input type="button" name="btnSet" value="Change Settings"
	    onclick="set()"/>
	  </td>
	</tr>

      </table>

    </center>

  </form>

  <h2>Protocol Simulation</h2>

  <p>
    The protocol simulation shows a time-sequence diagram with sources on one
    side and sinks on the other, the multiplexer and demultiplexer that support
    them, and a communications channel that carries messages. Sources request
    data transmission with
    <var>DATA(Source,Dn)</var>; the same messages arrive at sinks.
    Sources/sinks are numbered <var>0</var>, <var>1</var>, etc. Data
    messages are numbered <var>D0</var>, <var>D1</var>, etc.; no explicit data
    content is given. The source/sink number and data number are usually
    different (e.g. source <var>1</var> might sent data <var>D7</var>).
  </p>

  <center>

    <applet code="simulator.ProtocolSimulator.class"
     archive="ProtocolSimulator.jar" width="750" height="700"
     name="ProtocolSimulator">
      <param name="protocol" value="MUX"/>
    </applet>

  </center>

  <hr/>

  <p>
    <a href="index.html"><img src="uparrow.gif" alt="Up Arrow"/></a>
    Up one level to <a href="index.html">Protocol Simulators</a>
  </p>

</body>

</html>