<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 4327: Equal schedulers should be required to have same behaviour</title>
<meta property="og:title" content="Issue 4327: Equal schedulers should be required to have same behaviour">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4327.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="4327"><a href="lwg-active.html#4327">4327</a>. Equal schedulers should be required to have same behaviour</h3>
<p><b>Section:</b> 33.6 <a href="https://wg21.link/exec.sched">[exec.sched]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Lewis Baker <b>Opened:</b> 2025-08-25 <b>Last modified:</b> 2025-08-27</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View other</b> <a href="lwg-index-open.html#exec.sched">active issues</a> in [exec.sched].</p>
<p><b>View all other</b> <a href="lwg-index.html#exec.sched">issues</a> in [exec.sched].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The wording 33.6 <a href="https://wg21.link/exec.sched">[exec.sched]</a> p4 says:
</p>
<blockquote><p>
For any two values <code class='backtick'>sch1</code> and <code class='backtick'>sch2</code> of some scheduler type <code class='backtick'>Sch</code>, <code class='backtick'>sch1 == sch2</code> shall return 
<code class='backtick'>true</code> only if both <code class='backtick'>sch1</code> and <code class='backtick'>sch2</code> share the same associated execution resource.
</p></blockquote>
<p>
However, I don't think this requirement is sufficient for schedulers to be considered equal 
as it is possible to have two different schedulers that share the same associated execution 
resource but that have different behaviour.
<p/>
For example, two schedulers of the same type and having the same associated execution resource 
but where one schedules items with high priority and others with low priority.
<p/>
Ideally we want two schedulers to be equal if and only if they can be used interchangeably 
such that using either scheduler to schedule work has the same behaviour.
<p/>
Note that some use cases may also want to compare two schedulers as to whether or not they 
share the same associated execution resource, independently of their scheduling behaviour, 
however this could be added as a separate operator later, e.g. 
<code class='backtick'>std::execution::same_resource(sch1, sch2)</code>.
<p/>
While the above wording does still permit implementations to return <code class='backtick'>false</code> even if the associated 
execution resources are the same, it is not clear how this definition applies to schedulers 
such as an <code class='backtick'>inline_scheduler</code> (added in <a href="https://wg21.link/P3552" title=" Add a Coroutine Task Type">P3552</a>) in which has no specific associated 
execution resource but where instances nevertheless have the same scheduling behaviour.
<p/>
One approach to improving this would be to change p4 to refer to the schedulers having the 
same scheduling behaviour rather than having the same associated execution resource.
<p/>
For example, modify 33.6 <a href="https://wg21.link/exec.sched">[exec.sched]</a> p4 to refer to schedulers having the same 
scheduling behaviour rather than having the same associated execution resource.
</p>
<blockquote><p>
For any two values <code class='backtick'>sch1</code> and <code class='backtick'>sch2</code> of some scheduler type <code class='backtick'>Sch</code>, <code class='backtick'>sch1 == sch2</code> shall 
return <code class='backtick'>true</code> only if both <code class='backtick'>sch1</code> and <code class='backtick'>sch2</code> <del>share the same associated execution 
resource</del><ins>have the same scheduling behaviour</ins>.
</p></blockquote>
<p>
However, this then raises the question of exactly what "the same scheduling behaviour" is.
For example, what if two schedulers have the same associated execution resource and the 
same behaviour for a <code class='backtick'>schedule()</code> operation, but have different behaviours for customizations 
of the <code class='backtick'>bulk()</code> algorithm?
<p/>
Alternatively, we could talk about two schedulers being equal if and only if they can be used 
interchangeably throughout the program.
</p>


<p id="res-4327"><b>Proposed resolution:</b></p>





</body>
</html>
