<?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-01" 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>

<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</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-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 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:
H4sIAAAAAAAAA51Z23IbuRF9n69ApIdIKg5jya5Kluu4QpH0mlW6RaTKcW22
YnAGJBENB8wAI5mx/S/5lnxZTjcwN0r2JuEDOYNbA41zTjfAOI4j62Se/k1m
JlcD4YpSRXpb8JN1Zy9e/PDiLEqkGwidL01ky8VGW6tN7nZbtJ9O5m8jWSg5
ED+pXBUyix5XKM5TtVX4yp2Y1V2iKDVJLjfolxZy6eLUrDdqp4o4WUud212e
xC9Oo8hpl6HNwYhKZygdiKGg33Vhcv1P6TCWuCmMM4nJxNIUYuYKncCU+kcJ
k1pmYvJJJSU31Lm40LmShRhri3aL0qlU3OitylBsDyK5WBTqYSBqc1EmcyxC
5dH94yASIhZp05PfbXcyXLYNI/KLqszzmylSVYSuicGbzlv9wkIiWbq1KQZR
jCnbgRibcpVJi1/vJDT2vqsqbktrVZa1G5hiz/m3ymLlyZprE1PmrtgNxN0M
b2ojdYad8KP1q734E88np8p+YjZRbooNJvugyBO3b0dnp6c/DMShuJ3cXAxH
k4hgUbeI4jgWcgFnycRFUe1Roa2QItOrtXtU9C3kdpvphL0QZxJ2az8It5ZO
FGVuhXlAeQGvykWmxHx0gyXkuUqolxWRM62NUDCw1J+wtZnfbcaUMMv25pGR
RMFt6G3LZO1tubXahR1T9KILkZkEIHLS3lsCkPX4sg2+eEtFBOoIk2c7ATjj
XWHCu8oIdcRoYSJr7Bhmv9TFBvPQjlwC3qS7fjRHo3r11G5pSvgDT8oOotNj
WpkpHmWRigPqQrC1B+JRPqhedEbVC5nc+3qwuXBV3ctO1xqTVTVN/lWnu/qE
iVFlP+JZpcrqVS5WpSxk7hTcFjzBy9f5ilaci8c1voAUNBcLBdQovzQB57JH
Ur1cggEApNMbcj6ZLuBNXeCNHbg1OnexMzE/PNls0qdV484edn9dWpEbkWBY
6E5D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