<?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-02" 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="05"/>

    <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 
such that they execute their local tasks in strict sequential order 
and only after every process in the chain has confirmed it is ready.
The protocol has four phases:
1) a forward "readiness" wave,
2) a backward "start" wave,
3) a forward "execution" wave,
and 4) a backward exit wave.</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, 
thus 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 four-wave algorithm on a line topology that guarantees:</t>

<t><list style="numbers">
  <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>

<t>The protocol requires exactly 4(n-1) messages per synchronization round for an n-node chain (one READY and one START per directed link; and one COMPLETE in each direction).</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>The IP address and port of its predecessor (Head has none)</t>
  <t>The IP address and port of its successor (Tail has none)</t>
  <t>Whether it is Head, Tail, or intermediate (inferable from the presence/absence of a 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 the 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 the successor (if not Tail)</c>
      <c>WATCH</c>
      <c>Has propagated START leftward; waiting for COMPLETE from the predecessor (if not Head)</c>
      <c>START</c>
      <c>Currently executing its local task</c>
      <c>COMPLETE</c>
      <c>Local task finished; has sent COMPLETE to its successor (if any)</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 from SYNC to READY and sends <spanx style="verb">READY</spanx> to its 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 from SYNC to 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 its predecessor and moves to WATCH.</t>
  <t>An intermediate node, upon receiving <spanx style="verb">START</spanx> from its successor:
  <list style="numbers">
      <t>Sends <spanx style="verb">START</spanx> to its predecessor</t>
      <t>Moves to WATCH and waits for <spanx style="verb">COMPLETE</spanx> from its 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-execution-trigger-propagation-forward-wave"><name>Phase 3 -- Execution Trigger Propagation (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 execution.</t>
  <t>When a node finishes its task, it moves from START to COMPLETE and sends <spanx style="verb">COMPLETE</spanx> to its successor (triggers successor to start)</t>
</list></t>

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

</section>
<section anchor="phase-4-backward-propagating-exit-backward-wave"><name>Phase 4 -- Backward Propagating Exit (Backward Wave)</name>

<t><list style="symbols">
  <t>Tail, upon entering COMPLETE has no successor and therefore immediately sends <spanx style="verb">COMPLETE</spanx> to its predecessor and <bcp14>MAY</bcp14> terminate.</t>
  <t>An intermediate node in COMPLETE that receives <spanx style="verb">COMPLETE</spanx> from its successor sends <spanx style="verb">COMPLETE</spanx> to its predecessor and <bcp14>MAY</bcp14> terminate.</t>
  <t>Head, upon receiving <spanx style="verb">COMPLETE</spanx> from its successor <bcp14>MAY</bcp14> terminate.</t>
</list></t>

<t>The completion of this phase guarantees the Head node knows all nodes have completed execution.</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 />
|.....|.....|.....| Phase 4<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>
<t>The author thanks Grok, an AI system developed by xAI, for assistance in drafting portions of this document based on provided specifications, for editing, for suggestions on the ROUND-ID mechanism for concurrent rounds, and the backward propagation of COMPLETE messages to ensure clean termination.</t>

</section>


  </back>

<!-- ##markdown-source:
H4sIAAAAAAAAA51Z63LbuBX+z6dA7R+1PaJ27XimXW2aqSw5G8/4VkueNLPd
aSASkrCmCJUAbatJ3qXP0ifrdw7Am+Rk2+qHROJ2rt+5QHEcR9bJPP27zEyu
BsIVpYr0uuAn606+//6H70+iRLqB0PncRLacrbS12uRus8b6i/Pp20gWSg7E
TypXhcyipwWG81StFb5yJyb1lihKTZLLFfalhZy7ODXLldqoIk6WUud2kycx
qEVOuwxr9kY0OsHoQAwF/S4Lk+t/SoezxG1hnElMJuamEBNX6ASk1D9KkNQy
E+fPKil5oc7Fpc6VLMRYW6yblU6l4lavVYZhuxfJ2axQjwNRk4symUMIlUcP
T4NIiFikzU5+t11meGwdTuQXVZHnN1OkqghbE4M3nbf2BUEiWbqlKQZRDJbt
QIxNucikxa9XEhZ73VUTd6W1KsvaC0yxpfw7ZSF5suTZxJS5KzYDcT/Bm1pJ
ncES/rR+ZYs/Mz85TfYTs4pyU6zA7KMiTdy9HZ0cH/8wEPvi7vz2cjg6j8gt
6hVRHMdCzqAsmbgoqjUqtBVSZHqxdE+KvoVcrzOdsBbiTIJurQfhltKJosyt
MI8YL6BVOcuUmI5uIUKeq4R2WRE50zKEAoG5foZpM29t9ilh5m3jEZFEQW3Y
bctk6Wm5pdoEiyl60YXITAInctI+WHIg6/3LNv7FJhURoCNMnm0E3BnvCgxv
KiK0EacFRpawGLif62IFPrQjlQA36aYfTbGolp7WzU0JfeBJ2UF0fEiSmeJJ
FqnYoy3ktnZPPMlH1YtOaHomkwc/DzQXrpp71dla+2Q1TcyfdrarZzBGk/2I
uUqV1YtcLEpZyNwpqC1ogsXX+YIkzsXTEl/wFCwXMwWvUV40AeWyRl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