<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc version  (Ruby 3.2.3) -->


<!DOCTYPE rfc  [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">

]>


<rfc ipr="trust200902" docName="draft-dohmeyer-chainsync-00" category="info" submissionType="IETF" xml:lang="en">
  <front>
    <title abbrev="ChainSync">ChainSync: A Synchronization Protocol for Strict Sequential Execution in Linear Distributed Pipelines</title>

    <author initials="" surname="Douglas Dohmeyer" fullname="Douglas Russell Dohmeyer">
      <organization>Independent Researcher</organization>
      <address>
        <postal>
          <country>US</country>
        </postal>
        <email>douglas.dohmeyer@protonmail.com</email>
      </address>
    </author>

    <date year="2025" month="December" day="02"/>

    <area>General</area>
    <workgroup>Independent Submission</workgroup>
    <keyword>distributed</keyword> <keyword>synchronization</keyword> <keyword>pipeline</keyword> <keyword>execution</keyword> <keyword>ordered</keyword> <keyword>coordination</keyword> <keyword>protocol</keyword>

    <abstract>


<t>ChainSync is a lightweight application-layer protocol that runs over reliable TCP connections to synchronize a fixed linear chain of distributed processes (labeled A, B, C, ..., N) such that they execute their local tasks in strict sequential order (A -&gt; B -&gt; C -&gt; ... -&gt; N) <strong>and only after every process in the chain has confirmed it is ready</strong>.</t>

<t>The protocol uses three distinct phases:</t>

<t><list style="numbers">
  <t>Forward "readiness" wave (SYNC -&gt; READY propagation from head to tail)</t>
  <t>Backward "start" wave with deferred execution and watching (START propagation from tail to head)</t>
  <t>Forward "completion" wave that triggers execution in the required order and provides clean backward-propagating exit</t>
</list></t>

<t>The design guarantees strict ordering even when nodes become ready at very different times and requires only point-to-point TCP connections along the chain -- no central coordinator is needed.</t>



    </abstract>



  </front>

  <middle>


<section anchor="introduction"><name>Introduction</name>

<t>Many distributed workflows (pipeline parallelism in machine-learning training, staged data processing, multi-organization business processes, ordered multi-phase computation, etc.) require that tasks execute in a fixed order across different machines, yet must not begin until every participant is ready.</t>

<t>Standard barriers do not enforce execution order. Token-passing or leader-based schemes introduce complexity and single points of failure.</t>

<t>ChainSync solves this with a simple, fully decentralized three-wave algorithm on a line topology that guarantees:</t>

<t><list style="symbols">
  <t>No process starts until the entire chain is ready.</t>
  <t>Execution order is strictly A -&gt; B -&gt; ... -&gt; N.</t>
  <t>Clean backward-propagating exit after N finishes.</t>
</list></t>

<section anchor="requirements-language"><name>Requirements Language</name>

<t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>

</section>
<section anchor="topology-and-configuration"><name>Topology and Configuration</name>

<t>The processes form a static logical chain:</t>

<figure><artwork><![CDATA[
(Head) A <-> B <-> C <-> ... <-> N (Tail)
]]></artwork></figure>

<t>Each process knows:</t>

<t><list style="symbols">
  <t>IP address and port of its predecessor (Head has none)</t>
  <t>IP address and port of its successor (Tail has none)</t>
  <t>Whether it is head, tail, or intermediate (inferable from presence/absence of predecessor/successor)</t>
</list></t>

<t>Each adjacent pair maintains a single persistent bidirectional TCP connection.</t>

</section>
<section anchor="states"><name>States</name>

<texttable>
      <ttcol align='left'>State</ttcol>
      <ttcol align='left'>Meaning</ttcol>
      <c>SYNC</c>
      <c>Initial state; waiting for READY from predecessor (Head starts here but moves to READY when locally ready)</c>
      <c>READY</c>
      <c>Chain segment to the left is ready; has sent READY to successor</c>
      <c>WATCH</c>
      <c>Has propagated START leftward; waiting for COMPLETE from predecessor</c>
      <c>START</c>
      <c>Currently executing its local task</c>
      <c>COMPLETE</c>
      <c>Local task finished; has sent COMPLETE to both directions as required</c>
</texttable>

</section>
<section anchor="message-types"><name>Message Types</name>

<t>Messages are simple ASCII text lines terminated by LF. Recommended format:</t>

<t><spanx style="verb">&lt;COMMAND&gt;[:&lt;ROUND-ID&gt;]\n</spanx></t>

<t>Defined commands:</t>

<t><list style="symbols">
  <t><spanx style="verb">READY[:&lt;ROUND-ID&gt;]</spanx></t>
  <t><spanx style="verb">START[:&lt;ROUND-ID&gt;]</spanx></t>
  <t><spanx style="verb">COMPLETE[:&lt;ROUND-ID&gt;]</spanx></t>
</list></t>

<t><spanx style="verb">&lt;ROUND-ID&gt;</spanx> is optional but <bcp14>RECOMMENDED</bcp14> (e.g., UUID) to support multiple concurrent rounds on the same connection. Implementations running only one round at a time <bcp14>MAY</bcp14> omit it.</t>

</section>
<section anchor="protocol-operation"><name>Protocol Operation</name>

<section anchor="phase-1-readiness-collection-forward-wave"><name>Phase 1 -- Readiness Collection (Forward Wave)</name>

<t><list style="symbols">
  <t>Head (A), when locally ready, moves SYNC -&gt; READY and sends <spanx style="verb">READY</spanx> to successor.</t>
  <t>Every other node starts in SYNC. When it receives <spanx style="verb">READY</spanx> from predecessor <strong>and</strong> becomes locally ready, it moves SYNC -&gt; READY and sends <spanx style="verb">READY</spanx> to successor.</t>
  <t>When tail (N) enters READY, Phase 2 begins automatically.</t>
</list></t>

</section>
<section anchor="phase-2-start-trigger-propagation-backward-wave"><name>Phase 2 -- Start Trigger Propagation (Backward Wave)</name>

<t><list style="symbols">
  <t>Tail, upon entering READY, sends <spanx style="verb">START</spanx> to predecessor and moves to WATCH.</t>
  <t>Intermediate node, upon receiving <spanx style="verb">START</spanx> from successor:
  <list style="numbers">
      <t>Sends <spanx style="verb">START</spanx> to its predecessor (if any)</t>
      <t>Moves to WATCH and waits for <spanx style="verb">COMPLETE</spanx> from predecessor</t>
    </list></t>
  <t>Head, upon receiving <spanx style="verb">START</spanx>, has no predecessor and therefore moves directly to START and begins execution.</t>
</list></t>

<t>This phase completes in O(n) messages and guarantees every node knows the entire chain is ready before any node starts.</t>

</section>
<section anchor="phase-3-ordered-execution-and-completion-forward-wave"><name>Phase 3 -- Ordered Execution and Completion (Forward Wave)</name>

<t><list style="symbols">
  <t>A node in WATCH that receives <spanx style="verb">COMPLETE</spanx> from its predecessor moves to START and begins its local task.</t>
  <t>When a node finishes its task, it moves START -&gt; COMPLETE and:
  <list style="symbols">
      <t>Sends <spanx style="verb">COMPLETE</spanx> to successor (triggers successor to start)</t>
      <t>Sends <spanx style="verb">COMPLETE</spanx> to predecessor (allows predecessor to exit)</t>
    </list></t>
  <t>A node in COMPLETE that receives <spanx style="verb">COMPLETE</spanx> from its successor <bcp14>MAY</bcp14> terminate.</t>
</list></t>

<t>Execution order is therefore strictly A -&gt; B -&gt; C -&gt; ... -&gt; N.</t>

</section>
</section>
<section anchor="waiting-in-watch-state"><name>Waiting in WATCH State</name>

<t>The <bcp14>RECOMMENDED</bcp14> approach is <strong>push-based</strong>: the node simply blocks on read() from the predecessor's TCP socket. When the predecessor finishes, it pushes <spanx style="verb">COMPLETE</spanx>. An alternative approach is to poll the predecessor's TCP socket.</t>

<t>Both approaches are compliant.</t>

</section>
<section anchor="example-message-flow-a-b-c-d"><name>Example Message Flow (A-B-C-D)</name>
<t>RD: READY<br />
ST: START<br />
CM: COMPLETE</t>

<t>A.....B.....C.....D<br />
|-RD-&gt;|.....|.....| Phase 1 <br />
|.....|-RD-&gt;|.....|<br />
|.....|.....|-RD-&gt;|<br />
|.....|.....|&lt;-ST-| Phase 2<br />
|.....|&lt;-ST-|.....|<br />
|&lt;-ST-|.....|.....| Phase 3<br />
|.....|.....|.....| A starts immediately<br />
|-CM-&gt;|.....|.....| A finishes and B starts<br />
|.....|-CM-&gt;|.....| B finishes and C starts<br />
|.....|.....|-CM-&gt;| C finishes and D starts<br />
|.....|.....|&lt;-CM-| D finishes <br />
|.....|&lt;-CM-|.....X D exits<br />
|&lt;-CM-|.....X...... C exits<br />
|.....X............ B exits<br />
X.................. A exits</t>

</section>
</section>
<section anchor="IANA"><name>IANA Considerations</name>

<t>This memo includes no request to IANA.</t>

</section>
<section anchor="Security"><name>Security Considerations</name>

<t>Connections <bcp14>SHOULD</bcp14> use TLS 1.3. Production deployments <bcp14>SHOULD</bcp14> use mutual TLS with certificate pinning or pre-shared keys to prevent node impersonation.</t>

</section>


  </middle>

  <back>


    <references title='Normative References'>



<reference anchor='RFC2119'>
  <front>
    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
    <author fullname='S. Bradner' initials='S.' surname='Bradner'/>
    <date month='March' year='1997'/>
    <abstract>
      <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
    </abstract>
  </front>
  <seriesInfo name='BCP' value='14'/>
  <seriesInfo name='RFC' value='2119'/>
  <seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>

<reference anchor='RFC8174'>
  <front>
    <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
    <author fullname='B. Leiba' initials='B.' surname='Leiba'/>
    <date month='May' year='2017'/>
    <abstract>
      <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
    </abstract>
  </front>
  <seriesInfo name='BCP' value='14'/>
  <seriesInfo name='RFC' value='8174'/>
  <seriesInfo name='DOI' value='10.17487/RFC8174'/>
</reference>




    </references>



<section numbered="false" anchor="Acknowledgements"><name>Acknowledgements</name>

</section>


  </back>

<!-- ##markdown-source:
H4sIAAAAAAAAA51Z3XLbuhG+51Ns7YvKGlEndtJpj46bqSw5jWf8V0uZNHN6
poFISEJNESpB2lGTvEufpU/WbxcgRdrJ6Ux9IYnALnaxP9/u0nEcR65Uefp3
ldlcj6gsKh2ZbSG/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