<!doctype html><html lang="en">
 <head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <title>P2079R4: System execution context</title>
<style data-fill-with="stylesheet">/******************************************************************************
 *                   Style sheet for the W3C specifications                   *
 *
 * Special classes handled by this style sheet include:
 *
 * Indices
 *   - .toc for the Table of Contents (<ol class="toc">)
 *     + <span class="secno"> for the section numbers
 *   - #toc for the Table of Contents (<nav id="toc">)
 *   - ul.index for Indices (<a href="#ref">term</a><span>, in § N.M</span>)
 *   - table.index for Index Tables (e.g. for properties or elements)
 *
 * Structural Markup
 *   - table.data for general data tables
 *     -> use 'scope' attribute, <colgroup>, <thead>, and <tbody> for best results !
 *     -> use <table class='complex data'> for extra-complex tables
 *     -> use <td class='long'> for paragraph-length cell content
 *     -> use <td class='pre'> when manual line breaks/indentation would help readability
 *   - dl.switch for switch statements
 *   - ol.algorithm for algorithms (helps to visualize nesting)
 *   - .figure and .caption (HTML4) and figure and figcaption (HTML5)
 *     -> .sidefigure for right-floated figures
 *   - ins/del
 *     -> ins/del.c### for candidate and proposed changes (amendments)
 *
 * Code
 *   - pre and code
 *
 * Special Sections
 *   - .note       for informative notes             (div, p, span, aside, details)
 *   - .example    for informative examples          (div, p, pre, span)
 *   - .issue      for issues                        (div, p, span)
 *   - .advisement for loud normative statements     (div, p, strong)
 *   - .annoying-warning for spec obsoletion notices (div, aside, details)
 *   - .correction for "candidate corrections"       (div, aside, details, section)
 *   - .addition   for "candidate additions"         (div, aside, details, section)
 *   - .correction.proposed for "proposed corrections" (div, aside, details, section)
 *   - .addition.proposed   for "proposed additions"   (div, aside, details, section)
 *
 * Definition Boxes
 *   - pre.def   for WebIDL definitions
 *   - table.def for tables that define other entities (e.g. CSS properties)
 *   - dl.def    for definition lists that define other entitles (e.g. HTML elements)
 *
 * Numbering
 *   - .secno for section numbers in .toc and headings (<span class='secno'>3.2</span>)
 *   - .marker for source-inserted example/figure/issue numbers (<span class='marker'>Issue 4</span>)
 *   - ::before styled for CSS-generated issue/example/figure numbers:
 *     -> Documents wishing to use this only need to add
 *        figcaption::before,
 *        .caption::before { content: "Figure "  counter(figure) " ";  }
 *        .example::before { content: "Example " counter(example) " "; }
 *        .issue::before   { content: "Issue "   counter(issue) " ";   }
 *
 * Header Stuff (ignore, just don't conflict with these classes)
 *   - .head for the header
 *   - .copyright for the copyright
 *
 * Outdated warning for old specs
 *
 * Miscellaneous
 *   - .overlarge for things that should be as wide as possible, even if
 *     that overflows the body text area. This can be used on an item or
 *     on its container, depending on the effect desired.
 *     Note that this styling basically doesn't help at all when printing,
 *     since A4 paper isn't much wider than the max-width here.
 *     It's better to design things to fit into a narrower measure if possible.
 *
 *   - js-added ToC jump links (see fixup.js)
 *
 ******************************************************************************/

/* color variables included separately for reliability */

/******************************************************************************/
/*                                    Body                                    */
/******************************************************************************/

	html {
	}

	body {
		counter-reset: example figure issue;

		/* Layout */
		max-width: 50em;			  /* limit line length to 50em for readability   */
		margin: 0 auto;				/* center text within page                    */
		padding: 1.6em 1.5em 2em 50px; /* assume 16px font size for downlevel clients */
		padding: 1.6em 1.5em 2em calc(26px + 1.5em); /* leave space for status flag    */

		/* Typography */
		line-height: 1.5;
		font-family: sans-serif;
		widows: 2;
		orphans: 2;
		word-wrap: break-word;
		overflow-wrap: break-word;
		hyphens: auto;

		color: black;
		color: var(--text);
		background: white top left fixed no-repeat;
		background: var(--bg) top left fixed no-repeat;
		background-size: 25px auto;
	}


/******************************************************************************/
/*                         Front Matter & Navigation                          */
/******************************************************************************/

/** Header ********************************************************************/

	div.head { margin-bottom: 1em; }
	div.head hr { border-style: solid; }

	div.head h1 {
		font-weight: bold;
		margin: 0 0 .1em;
		font-size: 220%;
	}

	div.head h2 { margin-bottom: 1.5em;}

/** W3C Logo ******************************************************************/

	.head .logo {
		float: right;
		margin: 0.4rem 0 0.2rem .4rem;
	}

	.head img[src*="logos/W3C"] {
		display: block;
		border: solid #1a5e9a;
		border: solid var(--logo-bg);
		border-width: .65rem .7rem .6rem;
		border-radius: .4rem;
		background: #1a5e9a;
		background: var(--logo-bg);
		color: white;
		color: var(--logo-text);
		font-weight: bold;
	}

	.head a:hover > img[src*="logos/W3C"],
	.head a:focus > img[src*="logos/W3C"] {
		opacity: .8;
	}

	.head a:active > img[src*="logos/W3C"] {
		background: #c00;
		background: var(--logo-active-bg);
		border-color: #c00;
		border-color: var(--logo-active-bg);
	}

	/* see also additional rules in Link Styling section */

/** Copyright *****************************************************************/

	p.copyright,
	p.copyright small { font-size: small; }

/** Back to Top / ToC Toggle **************************************************/

	@media print {
		#toc-nav {
			display: none;
		}
	}
	@media not print {
		#toc-nav {
			position: fixed;
			z-index: 3;
			bottom: 0; left: 0;
			margin: 0;
			min-width: 1.33em;
			border-top-right-radius: 2rem;
			box-shadow: 0 0 2px;
			font-size: 1.5em;
		}
		#toc-nav > a {
			display: block;
			white-space: nowrap;

			height: 1.33em;
			padding: .1em 0.3em;
			margin: 0;

			box-shadow: 0 0 2px;
			border: none;
			border-top-right-radius: 1.33em;

			color: #707070;
			color: var(--tocnav-normal-text);
			background: white;
			background: var(--tocnav-normal-bg);
		}
		#toc-nav > a:hover,
		#toc-nav > a:focus {
			color: black;
			color: var(--tocnav-hover-text);
			background: #f8f8f8;
			background: var(--tocnav-hover-bg);
		}
		#toc-nav > a:active {
			color: #c00;
			color: var(--tocnav-active-text);
			background: white;
			background: var(--tocnav-active-bg);
		}

		#toc-nav > #toc-jump {
			padding-bottom: 2em;
			margin-bottom: -1.9em;
		}

		/* statusbar gets in the way on keyboard focus; remove once browsers fix */
		#toc-nav > a[href="#toc"]:not(:hover):focus:last-child {
			padding-bottom: 1.5rem;
		}

		#toc-nav:not(:hover) > a:not(:focus) > span + span {
			/* Ideally this uses :focus-within on #toc-nav */
			display: none;
		}
		#toc-nav > a > span + span {
			padding-right: 0.2em;
		}
	}

/** ToC Sidebar ***************************************************************/

	/* Floating sidebar */
	@media screen {
		body.toc-sidebar #toc {
			position: fixed;
			top: 0; bottom: 0;
			left: 0;
			width: 23.5em;
			max-width: 80%;
			max-width: calc(100% - 2em - 26px);
			overflow: auto;
			padding: 0 1em;
			padding-left: 42px;
			padding-left: calc(1em + 26px);
			color: black;
			color: var(--tocsidebar-text);
			background: inherit;
			background-color: #f7f8f9;
			background-color: var(--tocsidebar-bg);
			z-index: 1;
			box-shadow: -.1em 0 .25em rgba(0,0,0,.1) inset;
			box-shadow: -.1em 0 .25em var(--tocsidebar-shadow) inset;
		}
		body.toc-sidebar #toc h2 {
			margin-top: .8rem;
			font-variant: small-caps;
			font-variant: all-small-caps;
			text-transform: lowercase;
			font-weight: bold;
			color: gray;
			color: hsla(203,20%,40%,.7);
			color: var(--tocsidebar-heading-text);
		}
		body.toc-sidebar #toc-jump:not(:focus) {
			width: 0;
			height: 0;
			padding: 0;
			position: absolute;
			overflow: hidden;
		}
	}
	/* Hide main scroller when only the ToC is visible anyway */
	@media screen and (max-width: 28em) {
		body.toc-sidebar {
			overflow: hidden;
		}
	}

	/* Sidebar with its own space */
	@media screen and (min-width: 78em) {
		body:not(.toc-inline) #toc {
			position: fixed;
			top: 0; bottom: 0;
			left: 0;
			width: 23.5em;
			overflow: auto;
			padding: 0 1em;
			padding-left: 42px;
			padding-left: calc(1em + 26px);
			color: black;
			color: var(--tocsidebar-text);
			background: inherit;
			background-color: #f7f8f9;
			background-color: var(--tocsidebar-bg);
			z-index: 1;
			box-shadow: -.1em 0 .25em rgba(0,0,0,.1) inset;
			box-shadow: -.1em 0 .25em var(--tocsidebar-shadow) inset;
		}
		body:not(.toc-inline) #toc h2 {
			margin-top: .8rem;
			font-variant: small-caps;
			font-variant: all-small-caps;
			text-transform: lowercase;
			font-weight: bold;
			color: gray;
			color: hsla(203,20%,40%,.7);
			color: var(--tocsidebar-heading-text);
		}

		body:not(.toc-inline) {
			padding-left: 29em;
		}
		/* See also Overflow section at the bottom */

		body:not(.toc-inline) #toc-jump:not(:focus) {
			width: 0;
			height: 0;
			padding: 0;
			position: absolute;
			overflow: hidden;
		}
	}
	@media screen and (min-width: 90em) {
		body:not(.toc-inline) {
			margin: 0 4em;
		}
	}

/******************************************************************************/
/*                                Sectioning                                  */
/******************************************************************************/

/** Headings ******************************************************************/

	h1, h2, h3, h4, h5, h6, dt {
		page-break-after: avoid;
		page-break-inside: avoid;
		font: 100% sans-serif;   /* Reset all font styling to clear out UA styles */
		font-family: inherit;	/* Inherit the font family. */
		line-height: 1.2;		/* Keep wrapped headings compact */
		hyphens: manual;		/* Hyphenated headings look weird */
	}

	h2, h3, h4, h5, h6 {
		margin-top: 3rem;
	}

	h1, h2, h3 {
		color: #005A9C;
		color: var(--heading-text);
	}

	h1 { font-size: 170%; }
	h2 { font-size: 140%; }
	h3 { font-size: 120%; }
	h4 { font-weight: bold; }
	h5 { font-style: italic; }
	h6 { font-variant: small-caps; }
	dt { font-weight: bold; }

/** Subheadings ***************************************************************/

	h1 + h2,
	#profile-and-date {
		/* #profile-and-date is a subtitle in an H2 under the H1 */
		margin-top: 0;
	}
	h2 + h3,
	h3 + h4,
	h4 + h5,
	h5 + h6 {
		margin-top: 1.2em; /* = 1 x line-height */
	}

/** Section divider ***********************************************************/

	:not(.head) > :not(.head) + hr {
		font-size: 1.5em;
		text-align: center;
		margin: 1em auto;
		height: auto;
		color: black;
		color: var(--hr-text);
		border: transparent solid 0;
		background: transparent;
	}
	:not(.head) > hr::before {
		content: "\2727\2003\2003\2727\2003\2003\2727";
	}

/******************************************************************************/
/*                            Paragraphs and Lists                            */
/******************************************************************************/

	p {
		margin: 1em 0;
	}

	dd > p:first-child,
	li > p:first-child {
		margin-top: 0;
	}

	ul, ol {
		margin-left: 0;
		padding-left: 2em;
	}

	li {
		margin: 0.25em 0 0.5em;
		padding: 0;
	}

	dl dd {
		margin: 0 0 .5em 2em;
	}

	.head dd + dd { /* compact for header */
		margin-top: -.5em;
	}

	/* Style for algorithms */
	ol.algorithm ol:not(.algorithm),
	.algorithm > ol ol:not(.algorithm) {
	border-left: 0.5em solid #DEF;
	border-left: 0.5em solid var(--algo-border);
	}

	/* Put nice boxes around each algorithm. */
	[data-algorithm]:not(.heading) {
	 padding: .5em;
	 border: thin solid #ddd;
	 border: thin solid var(--algo-border);
	 border-radius: .5em;
	 margin: .5em calc(-0.5em - 1px);
	}
	[data-algorithm]:not(.heading) > :first-child {
	 margin-top: 0;
	}
	[data-algorithm]:not(.heading) > :last-child {
	 margin-bottom: 0;
	}

	/* Style for switch/case <dl>s */
	dl.switch > dd > ol.only,
	dl.switch > dd > .only > ol {
	margin-left: 0;
	}
	dl.switch > dd > ol.algorithm,
	dl.switch > dd > .algorithm > ol {
	margin-left: -2em;
	}
	dl.switch {
	padding-left: 2em;
	}
	dl.switch > dt {
	text-indent: -1.5em;
	margin-top: 1em;
	}
	dl.switch > dt + dt {
	margin-top: 0;
	}
	dl.switch > dt::before {
	content: '\21AA';
	padding: 0 0.5em 0 0;
	display: inline-block;
	width: 1em;
	text-align: right;
	line-height: 0.5em;
	}

/** Terminology Markup ********************************************************/


/******************************************************************************/
/*                                 Inline Markup                              */
/******************************************************************************/

/** Terminology Markup ********************************************************/
	dfn   { /* Defining instance */
		font-weight: bolder;
	}
	a > i { /* Instance of term */
		font-style: normal;
	}
	dt dfn code, code.idl {
		font-size: inherit;
	}
	dfn var {
		font-style: normal;
	}

/** Change Marking ************************************************************/

	del {
		color: #aa0000;
		color: var(--del-text);
		background: transparent;
		background: var(--del-bg);
		text-decoration: line-through;
	}
	ins {
		color: #006100;
		color: var(--ins-text);
		background: transparent;
		background: var(--ins-bg);
		text-decoration: underline;
	}

	/* for amendments (candidate/proposed changes) */

	.amendment ins, .correction ins, .addition ins,
	ins[class^=c] {
		text-decoration-style: dotted;
	}
	.amendment del, .correction del, .addition del,
	del[class^=c] {
		text-decoration-style: dotted;
	}
	.amendment.proposed ins, .correction.proposed ins, .addition.proposed ins,
	ins[class^=c].proposed {
		text-decoration-style: double;
	}
	.amendment.proposed del, .correction.proposed del, .addition.proposed del,
	del[class^=c].proposed {
		text-decoration-style: double;
	}

/** Miscellaneous improvements to inline formatting ***************************/

	sup {
		vertical-align: super;
		font-size: 80%
	}

/******************************************************************************/
/*                                    Code                                    */
/******************************************************************************/

/** General monospace/pre rules ***********************************************/

	pre, code, samp {
		font-family: Menlo, Consolas, "DejaVu Sans Mono", Monaco, monospace;
		font-size: .9em;
		hyphens: none;
		text-transform: none;
		text-align: left;
		text-align: start;
		font-variant: normal;
		orphans: 3;
		widows: 3;
		page-break-before: avoid;
	}
	pre code,
	code code {
		font-size: 100%;
	}

	pre {
		margin-top: 1em;
		margin-bottom: 1em;
		overflow: auto;
	}

/** Inline Code fragments *****************************************************/

	/* Do something nice. */

/******************************************************************************/
/*                                    Links                                   */
/******************************************************************************/

/** General Hyperlinks ********************************************************/

	/* We hyperlink a lot, so make it less intrusive */
	a[href] {
		color: #034575;
		color: var(--a-normal-text);
		text-decoration: underline #707070;
		text-decoration: underline var(--a-normal-underline);
		text-decoration-skip-ink: none;
	}
	a:visited {
		color: #034575;
		color: var(--a-visited-text);
		text-decoration-color: #bbb;
		text-decoration-color: var(--a-visited-underline);
	}

	/* Indicate interaction with the link */
	a[href]:focus,
	a[href]:hover {
		text-decoration-thickness: 2px;
	}
	a[href]:active {
		color: #c00;
		color: var(--a-active-text);
		text-decoration-color: #c00;
		text-decoration-color: var(--a-active-underline);
	}

	/* Backout above styling for W3C logo */
	.head .logo,
	.head .logo a {
		border: none;
		text-decoration: none;
		background: transparent;
	}

/******************************************************************************/
/*                                    Images                                  */
/******************************************************************************/

	img {
		border-style: none;
	}

	img, svg {
		/* Intentionally not color-scheme aware. */
		background: white;
	}

	/* For autogen numbers, add
	  .caption::before, figcaption::before { content: "Figure " counter(figure) ". "; }
	*/

	figure, .figure, .sidefigure {
		page-break-inside: avoid;
		text-align: center;
		margin: 2.5em 0;
	}
	.figure img,	.sidefigure img,	figure img,
	.figure object, .sidefigure object, figure object {
		max-width: 100%;
		margin: auto;
		height: auto;
	}
	.figure pre, .sidefigure pre, figure pre {
		text-align: left;
		display: table;
		margin: 1em auto;
	}
	.figure table, figure table {
		margin: auto;
	}
	@media screen and (min-width: 20em) {
		.sidefigure {
			float: right;
			width: 50%;
			margin: 0 0 0.5em 0.5em;
		}
	}
	.caption, figcaption, caption {
		font-style: italic;
		font-size: 90%;
	}
	.caption::before, figcaption::before, figcaption > .marker {
		font-weight: bold;
	}
	.caption, figcaption {
		counter-increment: figure;
	}

	/* DL list is indented 2em, but figure inside it is not */
	dd > .figure, dd > figure { margin-left: -2em; }

/******************************************************************************/
/*                             Colored Boxes                                  */
/******************************************************************************/

	.issue, .note, .example, .assertion, .advisement, blockquote,
	.amendment, .correction, .addition {
		margin: 1em auto;
		padding: .5em;
		border: .5em;
		border-left-style: solid;
		page-break-inside: avoid;
	}
	span.issue, span.note {
		padding: .1em .5em .15em;
		border-right-style: solid;
	}

	blockquote > :first-child,
	.note  > p:first-child,
	.issue > p:first-child,
	.amendment > p:first-child,
	.correction > p:first-child,
	.addition > p:first-child {
		margin-top: 0;
	}
	blockquote > :last-child,
	.note  > p:last-child,
	.issue > p:last-child,
	.amendment > p:last-child,
	.correction > p:last-child,
	.addition > p:last-child {
		margin-bottom: 0;
	}


	.issue::before, .issue > .marker,
	.example::before, .example > .marker,
	.note::before, .note > .marker,
	details.note > summary > .marker,
	.amendment::before, .amendment > .marker,
	details.amendment > summary > .marker,
	.addition::before, .addition > .marker,
	addition.amendment > summary > .marker,
	.correction::before, .correction > .marker,
	correction.amendment > summary > .marker
	{
		text-transform: uppercase;
		padding-right: 1em;
	}

	.example::before, .example > .marker {
		display: block;
		padding-right: 0em;
	}

/** Blockquotes ***************************************************************/

	blockquote {
		border-color: silver;
		border-color: var(--blockquote-border);
		background: transparent;
		background: var(--blockquote-bg);
		color: currentcolor;
		color: var(--blockquote-text);
	}

/** Open issue ****************************************************************/

	.issue {
		border-color: #e05252;
		border-color: var(--issue-border);
		background: #fbe9e9;
		background: var(--issue-bg);
		color: black;
		color: var(--issue-text);
		counter-increment: issue;
		overflow: auto;
	}
	.issue::before, .issue > .marker {
		color: #831616;
		color: var(--issueheading-text);
	}
	/* Add .issue::before { content: "Issue " counter(issue) " "; } for autogen numbers,
	  or use class="marker" to mark up the issue number in source. */

/** Example *******************************************************************/

	.example {
		border-color: #e0cb52;
		border-color: var(--example-border);
		background: #fcfaee;
		background: var(--example-bg);
		color: black;
		color: var(--example-text);
		counter-increment: example;
		overflow: auto;
		clear: both;
	}
	.example::before, .example > .marker {
		color: #574b0f;
		color: var(--exampleheading-text);
	}
	/* Add .example::before { content: "Example " counter(example) " "; } for autogen numbers,
	  or use class="marker" to mark up the example number in source. */

/** Non-normative Note ********************************************************/

	.note {
		border-color: #52e052;
		border-color: var(--note-border);
		background: #e9fbe9;
		background: var(--note-bg);
		color: black;
		color: var(--note-text);
		overflow: auto;
	}

	.note::before, .note > .marker,
	details.note > summary {
		color: hsl(120, 70%, 30%);
		color: var(--noteheading-text);
	}
	/* Add .note::before { content: "Note "; } for autogen label,
	  or use class="marker" to mark up the label in source. */

	details.note[open] > summary {
		border-bottom: 1px silver solid;
		border-bottom: 1px var(--notesummary-underline) solid;
	}

/** Assertion Box *************************************************************/
	/*  for assertions in algorithms */

	.assertion {
		border-color: #AAA;
		border-color: var(--assertion-border);
		background: #EEE;
		background: var(--assertion-bg);
		color: black;
		color: var(--assertion-text);
	}

/** Advisement Box ************************************************************/
	/*  for attention-grabbing normative statements */

	.advisement {
		border-color: orange;
		border-color: var(--advisement-border);
		border-style: none solid;
		background: #fec;
		background: var(--advisement-bg);
		color: black;
		color: var(--advisement-text);
	}
	strong.advisement {
		display: block;
		text-align: center;
	}
	.advisement::before, .advisement > .marker {
		color: #b35f00;
		color: var(--advisementheading-text);
	}

/** Amendment Box *************************************************************/

	.amendment, .correction, .addition {
		border-color: #330099;
		border-color: var(--amendment-border);
		background: #F5F0FF;
		background: var(--amendment-bg);
		color: black;
		color: var(--amendment-text);
	}
	.amendment.proposed, .correction.proposed, .addition.proposed {
		border-style: solid;
		border-block-width: 0.25em;
	}
	.amendment::before, .amendment > .marker,
	details.amendment > summary::before, details.amendment > summary > .marker,
	.correction::before, .correction > .marker,
	details.correction > summary::before, details.correction > summary > .marker,
	.addition::before, .addition > .marker,
	details.addition > summary::before, details.addition > summary > .marker {
		color: #220066;
		color: var(--amendmentheading-text);
	}
	.amendment.proposed::before, .amendment.proposed > .marker,
	details.amendment.proposed > summary::before, details.amendment.proposed > summary > .marker,
	.correction.proposed::before, .correction.proposed > .marker,
	details.correction.proposed > summary::before, details.correction.proposed > summary > .marker,
	.addition.proposed::before, .addition.proposed > .marker,
	details.addition.proposed > summary::before, details.addition.proposed > summary > .marker {
		font-weight: bold;
	}

/** Spec Obsoletion Notice ****************************************************/
	/* obnoxious obsoletion notice for older/abandoned specs. */

	details {
		display: block;
	}
	summary {
		font-weight: bolder;
	}

	.annoying-warning:not(details),
	details.annoying-warning:not([open]) > summary,
	details.annoying-warning[open] {
		background: hsla(40,100%,50%,0.95);
		background: var(--warning-bg);
		color: black;
		color: var(--warning-text);
		padding: .75em 1em;
		border: red;
		border: var(--warning-border);
		border-style: solid none;
		box-shadow: 0 2px 8px black;
		text-align: center;
	}
	.annoying-warning :last-child {
		margin-bottom: 0;
	}

@media not print {
	details.annoying-warning[open] {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 2em;
		z-index: 1000;
	}
}

	details.annoying-warning:not([open]) > summary {
		text-align: center;
	}

/** Entity Definition Boxes ***************************************************/

	.def {
		padding: .5em 1em;
		background: #def;
		background: var(--def-bg);
		margin: 1.2em 0;
		border-left: 0.5em solid #8ccbf2;
		border-left: 0.5em solid var(--def-border);
		color: black;
		color: var(--def-text);
	}

/******************************************************************************/
/*                                    Tables                                  */
/******************************************************************************/

	th, td {
		text-align: left;
		text-align: start;
	}

/** Property/Descriptor Definition Tables *************************************/

	table.def {
		/* inherits .def box styling, see above */
		width: 100%;
		border-spacing: 0;
	}

	table.def td,
	table.def th {
		padding: 0.5em;
		vertical-align: baseline;
		border-bottom: 1px solid #bbd7e9;
		border-bottom: 1px solid var(--defrow-border);
	}

	table.def > tbody > tr:last-child th,
	table.def > tbody > tr:last-child td {
		border-bottom: 0;
	}

	table.def th {
		font-style: italic;
		font-weight: normal;
		padding-left: 1em;
		width: 3em;
	}

	/* For when values are extra-complex and need formatting for readability */
	table td.pre {
		white-space: pre-wrap;
	}

	/* A footnote at the bottom of a def table */
	table.def td.footnote {
		padding-top: 0.6em;
	}
	table.def td.footnote::before {
		content: " ";
		display: block;
		height: 0.6em;
		width: 4em;
		border-top: thin solid;
	}

/** Data tables (and properly marked-up index tables) *************************/
	/*
		<table class="data"> highlights structural relationships in a table
		when correct markup is used (e.g. thead/tbody, th vs. td, scope attribute)

		Use class="complex data" for particularly complicated tables --
		(This will draw more lines: busier, but clearer.)

		Use class="long" on table cells with paragraph-like contents
		(This will adjust text alignment accordingly.)
		Alternately use class="longlastcol" on tables, to have the last column assume "long".
	*/

	table {
		word-wrap: normal;
		overflow-wrap: normal;
		hyphens: manual;
	}

	table.data,
	table.index {
		margin: 1em auto;
		border-collapse: collapse;
		border: hidden;
		width: 100%;
	}
	table.data caption,
	table.index caption {
		max-width: 50em;
		margin: 0 auto 1em;
	}

	table.data td,  table.data th,
	table.index td, table.index th {
		padding: 0.5em 1em;
		border-width: 1px;
		border-color: silver;
		border-color: var(--datacell-border);
		border-top-style: solid;
	}

	table.data thead td:empty {
		padding: 0;
		border: 0;
	}

	table.data  thead,
	table.index thead,
	table.data  tbody,
	table.index tbody {
		border-bottom: 2px solid;
	}

	table.data colgroup,
	table.index colgroup {
		border-left: 2px solid;
	}

	table.data  tbody th:first-child,
	table.index tbody th:first-child  {
		border-right: 2px solid;
		border-top: 1px solid silver;
		border-top: 1px solid var(--datacell-border);
		padding-right: 1em;
	}

	table.data th[colspan],
	table.data td[colspan] {
		text-align: center;
	}

	table.complex.data th,
	table.complex.data td {
		border: 1px solid silver;
		border: 1px solid var(--datacell-border);
		text-align: center;
	}

	table.data.longlastcol td:last-child,
	table.data td.long {
		vertical-align: baseline;
		text-align: left;
	}

	table.data img {
		vertical-align: middle;
	}


/*
Alternate table alignment rules

	table.data,
	table.index {
		text-align: center;
	}

	table.data  thead th[scope="row"],
	table.index thead th[scope="row"] {
		text-align: right;
	}

	table.data  tbody th:first-child,
	table.index tbody th:first-child  {
		text-align: right;
	}

Possible extra rowspan handling

	table.data  tbody th[rowspan]:not([rowspan='1']),
	table.index tbody th[rowspan]:not([rowspan='1']),
	table.data  tbody td[rowspan]:not([rowspan='1']),
	table.index tbody td[rowspan]:not([rowspan='1']) {
		border-left: 1px solid silver;
	}

	table.data  tbody th[rowspan]:first-child,
	table.index tbody th[rowspan]:first-child,
	table.data  tbody td[rowspan]:first-child,
	table.index tbody td[rowspan]:first-child{
		border-left: 0;
		border-right: 1px solid silver;
	}
*/

/******************************************************************************/
/*                                  Indices                                   */
/******************************************************************************/


/** Table of Contents *********************************************************/

	.toc a {
		/* More spacing; use padding to make it part of the click target. */
		padding: 0.1rem 1px 0;
		/* Larger, more consistently-sized click target */
		display: block;
		/* Switch to using border-bottom for underlines */
		text-decoration: none;
		border-bottom: 1px solid;
		/* Reverse color scheme */
		color: black;
		color: var(--toclink-text);
		border-color: #3980b5;
		border-color: var(--toclink-underline);
	}
	.toc a:visited {
		color: black;
		color: var(--toclink-visited-text);
		border-color: #054572;
		border-color: var(--toclink-visited-underline);
	}
	.toc a:focus,
	.toc a:hover {
		background: rgba(75%, 75%, 75%, .25);
		background: var(--a-hover-bg);
		border-bottom-width: 3px;
		margin-bottom: -2px;
	}
	.toc a:not(:focus):not(:hover) {
		/* Allow colors to cascade through from link styling */
		border-bottom-color: transparent;
	}

	.toc, .toc ol, .toc ul, .toc li {
		list-style: none; /* Numbers must be inlined into source */
		/* because generated content isn't search/selectable and markers can't do multilevel yet */
		margin:  0;
		padding: 0;
	}
	.toc {
		line-height: 1.1em;
	}

	/* ToC not indented until third level, but font style & margins show hierarchy */
	.toc > li			{ font-weight: bold;   }
	.toc > li li		 { font-weight: normal; }
	.toc > li li li	  { font-size:   95%;	}
	.toc > li li li li	{ font-size:   90%;	}
	.toc > li li li li li { font-size:   85%;	}

	/* @supports not (display:grid) { */
		.toc > li			{ margin: 1.5rem 0;	}
		.toc > li li		 { margin: 0.3rem 0;	}
		.toc > li li li	  { margin-left: 2rem;   }

		/* Section numbers in a column of their own */
		.toc .secno {
			float: left;
			width: 4rem;
			white-space: nowrap;
		}
		.toc > li li li li .secno { font-size: 85%; }
		.toc > li li li li li .secno { font-size: 100%; }

		.toc li {
			clear: both;
		}

		:not(li) > .toc			 { margin-left:  5rem; }
		.toc .secno				 { margin-left: -5rem; }
		.toc > li li li .secno	  { margin-left: -7rem; }
		.toc > li li li li .secno	{ margin-left: -9rem; }
		.toc > li li li li li .secno { margin-left: -11rem; }

		/* Tighten up indentation in narrow ToCs */
		@media (max-width: 30em) {
			:not(li) > .toc			 { margin-left:  4rem; }
			.toc .secno				 { margin-left: -4rem; }
			.toc > li li li			 { margin-left:  1rem; }
			.toc > li li li .secno	  { margin-left: -5rem; }
			.toc > li li li li .secno	{ margin-left: -6rem; }
			.toc > li li li li li .secno { margin-left: -7rem; }
		}
		/* Loosen it on wide screens */
		@media screen and (min-width: 78em) {
			body:not(.toc-inline) :not(li) > .toc			 { margin-left:  4rem; }
			body:not(.toc-inline) .toc .secno				 { margin-left: -4rem; }
			body:not(.toc-inline) .toc > li li li			 { margin-left:  1rem; }
			body:not(.toc-inline) .toc > li li li .secno	  { margin-left: -5rem; }
			body:not(.toc-inline) .toc > li li li li .secno	{ margin-left: -6rem; }
			body:not(.toc-inline) .toc > li li li li li .secno { margin-left: -7rem; }
	}
	/* } */

	@supports (display:grid) and (display:contents) {
		/* Use #toc over .toc to override non-@supports rules. */
		#toc {
			display: grid;
			align-content: start;
			grid-template-columns: auto 1fr;
			grid-column-gap: 1rem;
			column-gap: 1rem;
			grid-row-gap: .6rem;
			row-gap: .6rem;
		}
		#toc h2 {
			grid-column: 1 / -1;
			margin-bottom: 0;
		}
		#toc ol,
		#toc li,
		#toc a {
			display: contents;
			/* Switch <a> to subgrid when supported */
		}
		#toc span {
			margin: 0;
		}
		#toc > .toc > li > a > span {
			/* The spans of the top-level list,
			  comprising the first items of each top-level section. */
			margin-top: 1.1rem;
		}
		#toc#toc .secno { /* Ugh, need more specificity to override base.css */
			grid-column: 1;
			width: auto;
			margin-left: 0;
		}
		#toc .content {
			grid-column: 2;
			width: auto;
			margin-right: 1rem;
			border-bottom: 3px solid transparent;
			margin-bottom: -3px;
		}
		#toc .content:hover,
		#toc .content:focus {
			background: rgba(75%, 75%, 75%, .25);
			background: var(--a-hover-bg);
			border-bottom-color: #054572;
			border-bottom-color: var(--toclink-underline);
		}
		#toc li li li .content {
			margin-left: 1rem;
		}
		#toc li li li li .content {
			margin-left: 2rem;
		}
	}


/** Index *********************************************************************/

	/* Index Lists: Layout */
	ul.index	  { margin-left: 0; columns: 15em; text-indent: 1em hanging; }
	ul.index li	{ margin-left: 0; list-style: none; break-inside: avoid; }
	ul.index li li { margin-left: 1em; }
	ul.index dl	{ margin-top: 0; }
	ul.index dt	{ margin: .2em 0 .2em 20px;}
	ul.index dd	{ margin: .2em 0 .2em 40px;}
	/* Index Lists: Typography */
	ul.index ul,
	ul.index dl { font-size: smaller; }
	@media not print {
		ul.index li a + span {
			white-space: nowrap;
			color: transparent; }
		ul.index li a:hover + span,
		ul.index li a:focus + span {
			color: #707070;
			color: var(--indexinfo-text);
		}
	}

/** Index Tables *****************************************************/
	/* See also the data table styling section, which this effectively subclasses */

	table.index {
		font-size: small;
		border-collapse: collapse;
		border-spacing: 0;
		text-align: left;
		margin: 1em 0;
	}

	table.index td,
	table.index th {
		padding: 0.4em;
	}

	table.index tr:hover td:not([rowspan]),
	table.index tr:hover th:not([rowspan]) {
		color: black;
		color: var(--indextable-hover-text);
		background: #f7f8f9;
		background: var(--indextable-hover-bg);
	}

	/* The link in the first column in the property table (formerly a TD) */
	table.index th:first-child a {
		font-weight: bold;
	}

/** Outdated warning **********************************************************/

.outdated-spec {
	color: black;
	color: var(--outdatedspec-text);
	background-color: rgba(0,0,0,0.5);
	background-color: var(--outdatedspec-bg);
}

.outdated-warning {
	position: fixed;
	bottom: 50%;
	left: 0;
	right: 0;
	margin: 0 auto;
	width: 50%;
	background: maroon;
	background: var(--outdated-bg);
	color: white;
	color: var(--outdated-text);
	border-radius: 1em;
	box-shadow: 0 0 1em red;
	box-shadow: 0 0 1em var(--outdated-shadow);
	padding: 2em;
	text-align: center;
	z-index: 2;
}

.outdated-warning a {
	color: currentcolor;
	background: transparent;
}

.edited-rec-warning {
	background: darkorange;
	background: var(--editedrec-bg);
	box-shadow: 0 0 1em;
}

.outdated-warning button {
	color: var(--outdated-text);
	border-radius: 1em;
	box-shadow: 0 0 1em red;
	box-shadow: 0 0 1em var(--outdated-shadow);
	padding: 2em;
	text-align: center;
	z-index: 2;
}

.outdated-warning a {
	color: currentcolor;
	background: transparent;
}

.edited-rec-warning {
	background: darkorange;
	background: var(--editedrec-bg);
	box-shadow: 0 0 1em;
}

.outdated-warning button {
	position: absolute;
	top: 0;
	right:0;
	margin: 0;
	border: 0;
	padding: 0.25em 0.5em;
	background: transparent;
	color: white;
	color: var(--outdated-text);
	font:1em sans-serif;
	text-align:center;
}

.outdated-warning span {
	display: block;
}

.outdated-collapsed {
	bottom: 0;
	border-radius: 0;
	width: 100%;
	padding: 0;
}

/******************************************************************************/
/*                                    Print                                   */
/******************************************************************************/

	@media print {
		/* Pages have their own margins. */
		html {
			margin: 0;
		}
		/* Serif for print. */
		body {
			font-family: serif;
		}

		.outdated-warning {
			position: absolute;
			border-style: solid;
			border-color: red;
		}

		.outdated-warning input {
			display: none;
		}
	}
	@page {
		margin: 1.5cm 1.1cm;
	}



/******************************************************************************/
/*                             Overflow Control                               */
/******************************************************************************/

	.figure .caption, .sidefigure .caption, figcaption {
		/* in case figure is overlarge, limit caption to 50em */
		max-width: 50rem;
		margin-left: auto;
		margin-right: auto;
	}
	.overlarge {
		/* Magic to create good item positioning:
		  "content column" is 50ems wide at max; less on smaller screens.
		  Extra space (after ToC + content) is empty on the right.

		  1. When item < content column, centers item in column.
		  2. When content < item < available, left-aligns.
		  3. When item > available, fills available + scroll bar.
		*/
		display: grid;
		grid-template-columns: minmax(0, 50em);
	}
	.overlarge > table {
		/* limit preferred width of table */
		max-width: 50em;
		margin-left: auto;
		margin-right: auto;
	}

	@media (min-width: 55em) {
		.overlarge {
			margin-right: calc(13px + 26.5rem - 50vw);
			max-width: none;
		}
	}
	@media screen and (min-width: 78em) {
		body:not(.toc-inline) .overlarge {
			/* 30.5em body padding 50em content area */
			margin-right: calc(40em - 50vw) !important;
		}
	}
	@media screen and (min-width: 90em) {
		body:not(.toc-inline) .overlarge {
			/* 4em html margin 30.5em body padding 50em content area */
			margin-right: calc(84.5em - 100vw) !important;
		}
	}

	@media not print {
		.overlarge {
			overflow-x: auto;
			/* See Lea Verou's explanation background-attachment:
			* http://lea.verou.me/2012/04/background-attachment-local/
			*
			background: top left  / 4em 100% linear-gradient(to right,  #ffffff, rgba(255, 255, 255, 0)) local,
						top right / 4em 100% linear-gradient(to left, #ffffff, rgba(255, 255, 255, 0)) local,
						top left  / 1em 100% linear-gradient(to right,  #c3c3c5, rgba(195, 195, 197, 0)) scroll,
						top right / 1em 100% linear-gradient(to left, #c3c3c5, rgba(195, 195, 197, 0)) scroll,
						white;
			background-repeat: no-repeat;
			*/
		}
	}
</style>
<style>
    table, th, td {
      border: 1px solid black;
      border-collapse: collapse;
      vertical-align: top;
    }
    th, td {
      border-left: none;
      border-right: none;
      padding: 0px 10px;
    }
    th {
      text-align: center;
    }

    del { background: #fcc; color: #000; text-decoration: line-through; }
    ins { background: #cfc; color: #000; }
    blockquote .highlight:not(.idl) { background: initial; margin: initial; padding: 0.5em }
    blockquote ul { background: inherit; }
    blockquote code.highlight:not(.idl) { padding: initial; }
    blockquote c-[a] { color: inherit; } /* Keyword.Declaration */
    blockquote c-[b] { color: inherit; } /* Keyword.Type */
    blockquote c-[c] { color: inherit; } /* Comment */
    blockquote c-[d] { color: inherit; } /* Comment.Multiline */
    blockquote c-[e] { color: inherit; } /* Name.Attribute */
    blockquote c-[f] { color: inherit; } /* Name.Tag */
    blockquote c-[g] { color: inherit; } /* Name.Variable */
    blockquote c-[k] { color: inherit; } /* Keyword */
    blockquote c-[l] { color: inherit; } /* Literal */
    blockquote c-[m] { color: inherit; } /* Literal.Number */
    blockquote c-[n] { color: inherit; } /* Name */
    blockquote c-[o] { color: inherit; } /* Operator */
    blockquote c-[p] { color: inherit; } /* Punctuation */
    blockquote c-[s] { color: inherit; } /* Literal.String */
    blockquote c-[t] { color: inherit; } /* Literal.String.Single */
    blockquote c-[u] { color: inherit; } /* Literal.String.Double */
    blockquote c-[cp] { color: inherit; } /* Comment.Preproc */
    blockquote c-[c1] { color: inherit; } /* Comment.Single */
    blockquote c-[cs] { color: inherit; } /* Comment.Special */
    blockquote c-[kc] { color: inherit; } /* Keyword.Constant */
    blockquote c-[kn] { color: inherit; } /* Keyword.Namespace */
    blockquote c-[kp] { color: inherit; } /* Keyword.Pseudo */
    blockquote c-[kr] { color: inherit; } /* Keyword.Reserved */
    blockquote c-[ld] { color: inherit; } /* Literal.Date */
    blockquote c-[nc] { color: inherit; } /* Name.Class */
    blockquote c-[no] { color: inherit; } /* Name.Constant */
    blockquote c-[nd] { color: inherit; } /* Name.Decorator */
    blockquote c-[ni] { color: inherit; } /* Name.Entity */
    blockquote c-[ne] { color: inherit; } /* Name.Exception */
    blockquote c-[nf] { color: inherit; } /* Name.Function */
    blockquote c-[nl] { color: inherit; } /* Name.Label */
    blockquote c-[nn] { color: inherit; } /* Name.Namespace */
    blockquote c-[py] { color: inherit; } /* Name.Property */
    blockquote c-[ow] { color: inherit; } /* Operator.Word */
    blockquote c-[mb] { color: inherit; } /* Literal.Number.Bin */
    blockquote c-[mf] { color: inherit; } /* Literal.Number.Float */
    blockquote c-[mh] { color: inherit; } /* Literal.Number.Hex */
    blockquote c-[mi] { color: inherit; } /* Literal.Number.Integer */
    blockquote c-[mo] { color: inherit; } /* Literal.Number.Oct */
    blockquote c-[sb] { color: inherit; } /* Literal.String.Backtick */
    blockquote c-[sc] { color: inherit; } /* Literal.String.Char */
    blockquote c-[sd] { color: inherit; } /* Literal.String.Doc */
    blockquote c-[se] { color: inherit; } /* Literal.String.Escape */
    blockquote c-[sh] { color: inherit; } /* Literal.String.Heredoc */
    blockquote c-[si] { color: inherit; } /* Literal.String.Interpol */
    blockquote c-[sx] { color: inherit; } /* Literal.String.Other */
    blockquote c-[sr] { color: inherit; } /* Literal.String.Regex */
    blockquote c-[ss] { color: inherit; } /* Literal.String.Symbol */
    blockquote c-[vc] { color: inherit; } /* Name.Variable.Class */
    blockquote c-[vg] { color: inherit; } /* Name.Variable.Global */
    blockquote c-[vi] { color: inherit; } /* Name.Variable.Instance */
    blockquote c-[il] { color: inherit; } /* Literal.Number.Integer.Long */
  </style>
  <meta content="Bikeshed version d5d58a306, updated Fri Jan 26 16:12:28 2024 -0800" name="generator">
  <link href="http://wg21.link/P2079R4" rel="canonical">
  <link href="https://isocpp.org/favicon.ico" rel="icon">
  <meta content="6c4ba88dd9b62fd5dbcd42bb734517812435c0d9" name="revision">
<style>/* Boilerplate: style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
    color: var(--a-normal-text);
    font-size: inherit;
    font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
    content: "‘";
}
.css::after, .property::after, .descriptor::after {
    content: "’";
}
.property, .descriptor {
    /* Don't wrap property and descriptor names */
    white-space: nowrap;
}
.type { /* CSS value <type> */
    font-style: italic;
}
pre .property::before, pre .property::after {
    content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
    content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
    content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
    content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
    font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after  { content: ">" }

[data-link-type=biblio] {
    white-space: pre;
}

@media (prefers-color-scheme: dark) {
    :root {
        --selflink-text: black;
        --selflink-bg: silver;
        --selflink-hover-text: white;
    }
}
</style>
<style>/* Boilerplate: style-colors */
/* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */
:root {
    color-scheme: light dark;

    --text: black;
    --bg: white;

    --unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark);

    --logo-bg: #1a5e9a;
    --logo-active-bg: #c00;
    --logo-text: white;

    --tocnav-normal-text: #707070;
    --tocnav-normal-bg: var(--bg);
    --tocnav-hover-text: var(--tocnav-normal-text);
    --tocnav-hover-bg: #f8f8f8;
    --tocnav-active-text: #c00;
    --tocnav-active-bg: var(--tocnav-normal-bg);

    --tocsidebar-text: var(--text);
    --tocsidebar-bg: #f7f8f9;
    --tocsidebar-shadow: rgba(0,0,0,.1);
    --tocsidebar-heading-text: hsla(203,20%,40%,.7);

    --toclink-text: var(--text);
    --toclink-underline: #3980b5;
    --toclink-visited-text: var(--toclink-text);
    --toclink-visited-underline: #054572;

    --heading-text: #005a9c;

    --hr-text: var(--text);

    --algo-border: #def;

    --del-text: red;
    --del-bg: transparent;
    --ins-text: #080;
    --ins-bg: transparent;

    --a-normal-text: #034575;
    --a-normal-underline: #bbb;
    --a-visited-text: var(--a-normal-text);
    --a-visited-underline: #707070;
    --a-hover-bg: rgba(75%, 75%, 75%, .25);
    --a-active-text: #c00;
    --a-active-underline: #c00;

    --blockquote-border: silver;
    --blockquote-bg: transparent;
    --blockquote-text: currentcolor;

    --issue-border: #e05252;
    --issue-bg: #fbe9e9;
    --issue-text: var(--text);
    --issueheading-text: #831616;

    --example-border: #e0cb52;
    --example-bg: #fcfaee;
    --example-text: var(--text);
    --exampleheading-text: #574b0f;

    --note-border: #52e052;
    --note-bg: #e9fbe9;
    --note-text: var(--text);
    --noteheading-text: hsl(120, 70%, 30%);
    --notesummary-underline: silver;

    --assertion-border: #aaa;
    --assertion-bg: #eee;
    --assertion-text: black;

    --advisement-border: orange;
    --advisement-bg: #fec;
    --advisement-text: var(--text);
    --advisementheading-text: #b35f00;

    --warning-border: red;
    --warning-bg: hsla(40,100%,50%,0.95);
    --warning-text: var(--text);

    --amendment-border: #330099;
    --amendment-bg: #F5F0FF;
    --amendment-text: var(--text);
    --amendmentheading-text: #220066;

    --def-border: #8ccbf2;
    --def-bg: #def;
    --def-text: var(--text);
    --defrow-border: #bbd7e9;

    --datacell-border: silver;

    --indexinfo-text: #707070;

    --indextable-hover-text: black;
    --indextable-hover-bg: #f7f8f9;

    --outdatedspec-bg: rgba(0, 0, 0, .5);
    --outdatedspec-text: black;
    --outdated-bg: maroon;
    --outdated-text: white;
    --outdated-shadow: red;

    --editedrec-bg: darkorange;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #ddd;
        --bg: black;

        --unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E");

        --logo-bg: #1a5e9a;
        --logo-active-bg: #c00;
        --logo-text: white;

        --tocnav-normal-text: #999;
        --tocnav-normal-bg: var(--bg);
        --tocnav-hover-text: var(--tocnav-normal-text);
        --tocnav-hover-bg: #080808;
        --tocnav-active-text: #f44;
        --tocnav-active-bg: var(--tocnav-normal-bg);

        --tocsidebar-text: var(--text);
        --tocsidebar-bg: #080808;
        --tocsidebar-shadow: rgba(255,255,255,.1);
        --tocsidebar-heading-text: hsla(203,20%,40%,.7);

        --toclink-text: var(--text);
        --toclink-underline: #6af;
        --toclink-visited-text: var(--toclink-text);
        --toclink-visited-underline: #054572;

        --heading-text: #8af;

        --hr-text: var(--text);

        --algo-border: #456;

        --del-text: #f44;
        --del-bg: transparent;
        --ins-text: #4a4;
        --ins-bg: transparent;

        --a-normal-text: #6af;
        --a-normal-underline: #555;
        --a-visited-text: var(--a-normal-text);
        --a-visited-underline: var(--a-normal-underline);
        --a-hover-bg: rgba(25%, 25%, 25%, .2);
        --a-active-text: #f44;
        --a-active-underline: var(--a-active-text);

        --borderedblock-bg: rgba(255, 255, 255, .05);

        --blockquote-border: silver;
        --blockquote-bg: var(--borderedblock-bg);
        --blockquote-text: currentcolor;

        --issue-border: #e05252;
        --issue-bg: var(--borderedblock-bg);
        --issue-text: var(--text);
        --issueheading-text: hsl(0deg, 70%, 70%);

        --example-border: hsl(50deg, 90%, 60%);
        --example-bg: var(--borderedblock-bg);
        --example-text: var(--text);
        --exampleheading-text: hsl(50deg, 70%, 70%);

        --note-border: hsl(120deg, 100%, 35%);
        --note-bg: var(--borderedblock-bg);
        --note-text: var(--text);
        --noteheading-text: hsl(120, 70%, 70%);
        --notesummary-underline: silver;

        --assertion-border: #444;
        --assertion-bg: var(--borderedblock-bg);
        --assertion-text: var(--text);

        --advisement-border: orange;
        --advisement-bg: #222218;
        --advisement-text: var(--text);
        --advisementheading-text: #f84;

        --warning-border: red;
        --warning-bg: hsla(40,100%,20%,0.95);
        --warning-text: var(--text);

        --amendment-border: #330099;
        --amendment-bg: #080010;
        --amendment-text: var(--text);
        --amendmentheading-text: #cc00ff;

        --def-border: #8ccbf2;
        --def-bg: #080818;
        --def-text: var(--text);
        --defrow-border: #136;

        --datacell-border: silver;

        --indexinfo-text: #aaa;

        --indextable-hover-text: var(--text);
        --indextable-hover-bg: #181818;

        --outdatedspec-bg: rgba(255, 255, 255, .5);
        --outdatedspec-text: black;
        --outdated-bg: maroon;
        --outdated-text: white;
        --outdated-shadow: red;

        --editedrec-bg: darkorange;
    }
    /* In case a transparent-bg image doesn't expect to be on a dark bg,
       which is quite common in practice... */
    img { background: white; }
}
</style>
<style>/* Boilerplate: style-counters */
body {
    counter-reset: example figure issue;
}
.issue {
    counter-increment: issue;
}
.issue:not(.no-marker)::before {
    content: "Issue " counter(issue);
}

.example {
    counter-increment: example;
}
.example:not(.no-marker)::before {
    content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
    content: "Invalid Example" counter(example);
}

figcaption {
    counter-increment: figure;
}
figcaption:not(.no-marker)::before {
    content: "Figure " counter(figure) " ";
}
</style>
<style>/* Boilerplate: style-issues */
a[href].issue-return {
    float: right;
    float: inline-end;
    color: var(--issueheading-text);
    font-weight: bold;
    text-decoration: none;
}
</style>
<style>/* Boilerplate: style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
   regarding paragraph and lists. */
[data-md] > :first-child {
    margin-top: 0;
}
[data-md] > :last-child {
    margin-bottom: 0;
}
</style>
<style>/* Boilerplate: style-selflinks */
:root {
    --selflink-text: white;
    --selflink-bg: gray;
    --selflink-hover-text: black;
}
.heading, .issue, .note, .example, li, dt {
    position: relative;
}
a.self-link {
    position: absolute;
    top: 0;
    left: calc(-1 * (3.5rem - 26px));
    width: calc(3.5rem - 26px);
    height: 2em;
    text-align: center;
    border: none;
    transition: opacity .2s;
    opacity: .5;
}
a.self-link:hover {
    opacity: 1;
}
.heading > a.self-link {
    font-size: 83%;
}
.example > a.self-link,
.note > a.self-link,
.issue > a.self-link {
    /* These blocks are overflow:auto, so positioning outside
       doesn't work. */
    left: auto;
    right: 0;
}
li > a.self-link {
    left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
    top: auto;
    left: auto;
    opacity: 0;
    width: 1.5em;
    height: 1.5em;
    background: var(--selflink-bg);
    color: var(--selflink-text);
    font-style: normal;
    transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
    opacity: 1;
}
dfn > a.self-link:hover {
    color: var(--selflink-hover-text);
}

a.self-link::before            { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before      { content: "#"; }
</style>
<style>/* Boilerplate: style-syntax-highlighting */
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }

.highlight:not(.idl) { background: rgba(0, 0, 0, .03); }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */

@media (prefers-color-scheme: dark) {
    .highlight:not(.idl) { background: rgba(255, 255, 255, .05); }

    c-[a] { color: #d33682 } /* Keyword.Declaration */
    c-[b] { color: #d33682 } /* Keyword.Type */
    c-[c] { color: #2aa198 } /* Comment */
    c-[d] { color: #2aa198 } /* Comment.Multiline */
    c-[e] { color: #268bd2 } /* Name.Attribute */
    c-[f] { color: #b58900 } /* Name.Tag */
    c-[g] { color: #cb4b16 } /* Name.Variable */
    c-[k] { color: #d33682 } /* Keyword */
    c-[l] { color: #657b83 } /* Literal */
    c-[m] { color: #657b83 } /* Literal.Number */
    c-[n] { color: #268bd2 } /* Name */
    c-[o] { color: #657b83 } /* Operator */
    c-[p] { color: #657b83 } /* Punctuation */
    c-[s] { color: #6c71c4 } /* Literal.String */
    c-[t] { color: #6c71c4 } /* Literal.String.Single */
    c-[u] { color: #6c71c4 } /* Literal.String.Double */
    c-[ch] { color: #2aa198 } /* Comment.Hashbang */
    c-[cp] { color: #2aa198 } /* Comment.Preproc */
    c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */
    c-[c1] { color: #2aa198 } /* Comment.Single */
    c-[cs] { color: #2aa198 } /* Comment.Special */
    c-[kc] { color: #d33682 } /* Keyword.Constant */
    c-[kn] { color: #d33682 } /* Keyword.Namespace */
    c-[kp] { color: #d33682 } /* Keyword.Pseudo */
    c-[kr] { color: #d33682 } /* Keyword.Reserved */
    c-[ld] { color: #657b83 } /* Literal.Date */
    c-[nc] { color: #268bd2 } /* Name.Class */
    c-[no] { color: #268bd2 } /* Name.Constant */
    c-[nd] { color: #268bd2 } /* Name.Decorator */
    c-[ni] { color: #268bd2 } /* Name.Entity */
    c-[ne] { color: #268bd2 } /* Name.Exception */
    c-[nf] { color: #268bd2 } /* Name.Function */
    c-[nl] { color: #268bd2 } /* Name.Label */
    c-[nn] { color: #268bd2 } /* Name.Namespace */
    c-[py] { color: #268bd2 } /* Name.Property */
    c-[ow] { color: #657b83 } /* Operator.Word */
    c-[mb] { color: #657b83 } /* Literal.Number.Bin */
    c-[mf] { color: #657b83 } /* Literal.Number.Float */
    c-[mh] { color: #657b83 } /* Literal.Number.Hex */
    c-[mi] { color: #657b83 } /* Literal.Number.Integer */
    c-[mo] { color: #657b83 } /* Literal.Number.Oct */
    c-[sa] { color: #6c71c4 } /* Literal.String.Affix */
    c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */
    c-[sc] { color: #6c71c4 } /* Literal.String.Char */
    c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */
    c-[sd] { color: #6c71c4 } /* Literal.String.Doc */
    c-[se] { color: #6c71c4 } /* Literal.String.Escape */
    c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */
    c-[si] { color: #6c71c4 } /* Literal.String.Interpol */
    c-[sx] { color: #6c71c4 } /* Literal.String.Other */
    c-[sr] { color: #6c71c4 } /* Literal.String.Regex */
    c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */
    c-[fm] { color: #268bd2 } /* Name.Function.Magic */
    c-[vc] { color: #cb4b16 } /* Name.Variable.Class */
    c-[vg] { color: #cb4b16 } /* Name.Variable.Global */
    c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */
    c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */
    c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */
}
</style>
 <body class="h-entry">
  <div class="head">
   <p data-fill-with="logo"></p>
   <h1 class="p-name no-ref" id="title">P2079R4<br>System execution context</h1>
   <h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Published Proposal, <time class="dt-updated" datetime="2024-05-21">2024-05-21</time></span></h2>
   <div data-fill-with="spec-metadata">
    <dl>
     <dt>This version:
     <dd><a class="u-url" href="http://wg21.link/P2079R4">http://wg21.link/P2079R4</a>
     <dt class="editor">Authors:
     <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:lwh@fb.com">Lee Howes</a>
     <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:ruslan.arutyunyan@intel.com">Ruslan Arutyunyan</a> (<span class="p-org org">Intel</span>)
     <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:michaelj.voss@intel.com">Michael Voss</a> (<span class="p-org org">Intel</span>)
     <dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:lucteo@lucteo.ro">Lucian Radu Teodorescu</a>
     <dt>Audience:
     <dd>SG1, LEWG
     <dt>Project:
     <dd>ISO/IEC 14882 Programming Languages — C++, ISO/IEC JTC1/SC22/WG21
    </dl>
   </div>
   <div data-fill-with="warning"></div>
   <hr title="Separator for header">
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>A standard execution context based on the facilities in <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a> that implements parallel-forward-progress to
maximise portability. A set of <code class="highlight"><c- n>system_context</c-></code>`s share an underlying shared thread pool implementation, and may
provide an interface to an OS-provided system thread pool.</p>
  </div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li>
     <a href="#changes"><span class="secno">1</span> <span class="content">Changes</span></a>
     <ol class="toc">
      <li><a href="#r4"><span class="secno">1.1</span> <span class="content">R4</span></a>
      <li><a href="#r3"><span class="secno">1.2</span> <span class="content">R3</span></a>
      <li><a href="#r2"><span class="secno">1.3</span> <span class="content">R2</span></a>
      <li><a href="#r1"><span class="secno">1.4</span> <span class="content">R1</span></a>
      <li><a href="#r0"><span class="secno">1.5</span> <span class="content">R0</span></a>
     </ol>
    <li><a href="#introduction"><span class="secno">2</span> <span class="content">Introduction</span></a>
    <li>
     <a href="#design"><span class="secno">3</span> <span class="content">Design</span></a>
     <ol class="toc">
      <li><a href="#system_context"><span class="secno">3.1</span> <span class="content"><code class="highlight"><c- n>system_context</c-></code></span></a>
      <li><a href="#system_scheduler"><span class="secno">3.2</span> <span class="content"><code class="highlight"><c- n>system_scheduler</c-></code></span></a>
      <li><a href="#system_sender"><span class="secno">3.3</span> <span class="content"><code class="highlight"><c- n>system_sender</c-></code></span></a>
     </ol>
    <li>
     <a href="#design_considerations"><span class="secno">4</span> <span class="content">Design discussion and decisions</span></a>
     <ol class="toc">
      <li><a href="#drive_not_drive"><span class="secno">4.1</span> <span class="content">To drive or not to drive</span></a>
      <li><a href="#freestanding_implementations"><span class="secno">4.2</span> <span class="content">Freestanding implementations</span></a>
      <li>
       <a href="#replaceable_system_context"><span class="secno">4.3</span> <span class="content">Making <code class="highlight"><c- n>system_context</c-></code> implementation-defined and replaceable</span></a>
       <ol class="toc">
        <li>
         <a href="#bad_link_time_replaceability_examples"><span class="secno">4.3.1</span> <span class="content">Link-time replaceability is not perfect</span></a>
         <ol class="toc">
          <li><a href="#example_on_linux"><span class="secno">4.3.1.1</span> <span class="content">Example on Linux</span></a>
          <li><a href="#example_on_windows"><span class="secno">4.3.1.2</span> <span class="content">Example on Windows</span></a>
          <li><a href="#replaceability_conclusion"><span class="secno">4.3.1.3</span> <span class="content">Conclusion</span></a>
         </ol>
       </ol>
      <li><a href="#extensibility"><span class="secno">4.4</span> <span class="content">Extensibility</span></a>
      <li><a href="#system_scheduler_abi"><span class="secno">4.5</span> <span class="content">ABI for <code class="highlight"><c- n>system_scheduler</c-></code></span></a>
      <li><a href="#shareability"><span class="secno">4.6</span> <span class="content">Shareability</span></a>
      <li><a href="#performance"><span class="secno">4.7</span> <span class="content">Performance</span></a>
      <li><a href="#lifetime"><span class="secno">4.8</span> <span class="content">Lifetime</span></a>
      <li><a href="#expose_system_context_name"><span class="secno">4.9</span> <span class="content">Need for the <code class="highlight"><c- n>system_context</c-></code> class</span></a>
      <li><a href="#priorities"><span class="secno">4.10</span> <span class="content">Priorities</span></a>
      <li><a href="#reference_implementation"><span class="secno">4.11</span> <span class="content">Reference implementation</span></a>
      <li>
       <a href="#addressing_feedback"><span class="secno">4.12</span> <span class="content">Addressing received feedback</span></a>
       <ol class="toc">
        <li><a href="#borrow_threads"><span class="secno">4.12.1</span> <span class="content">Allow for system context to borrow threads</span></a>
        <li><a href="#wtp_and_gcd"><span class="secno">4.12.2</span> <span class="content">Allow implementations to use Grand Central Dispatch and Windows Thread Pool</span></a>
        <li><a href="#priorities_and_elastic_pools"><span class="secno">4.12.3</span> <span class="content">Priorities and elastic pools</span></a>
        <li><a href="#less_portability_with_implementation_defined"><span class="secno">4.12.4</span> <span class="content">Implementation-defined may make things less portable</span></a>
       </ol>
     </ol>
    <li>
     <a href="#open_questions"><span class="secno">5</span> <span class="content">Questions to ask LEWG/SG1/vendors</span></a>
     <ol class="toc">
      <li><a href="#replaceability_question"><span class="secno">5.1</span> <span class="content">What type of replaceability we want?</span></a>
      <li><a href="#standardize_system_scheduler_abi"><span class="secno">5.2</span> <span class="content">Do we want to standardize an ABI for <code class="highlight"><c- n>system_scheduler</c-></code> (as opposed to leaving this to be implementation defined)?</span></a>
      <li><a href="#system_scheduler_before_main"><span class="secno">5.3</span> <span class="content">Do we want to allow system scheduler to be used before start of <code class="highlight"><c- n>main</c-><c- p>()</c-></code> ?</span></a>
     </ol>
    <li><a href="#examples"><span class="secno">6</span> <span class="content">Examples</span></a>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
   </ol>
  </nav>
  <main>
   <h2 class="heading settled" data-level="1" id="changes"><span class="secno">1. </span><span class="content">Changes</span><a class="self-link" href="#changes"></a></h2>
   <h3 class="heading settled" data-level="1.1" id="r4"><span class="secno">1.1. </span><span class="content">R4</span><a class="self-link" href="#r4"></a></h3>
   <ul>
    <li data-md>
     <p>Add more design considerations &amp; goals.</p>
    <li data-md>
     <p>Add comparison of different replaceability options</p>
    <li data-md>
     <p>Add motivation for replaceabiilty ABI standardization</p>
    <li data-md>
     <p>Add the example of the ABI for replacement</p>
    <li data-md>
     <p>Strengthen the lifetime guarantees.</p>
   </ul>
   <h3 class="heading settled" data-level="1.2" id="r3"><span class="secno">1.2. </span><span class="content">R3</span><a class="self-link" href="#r3"></a></h3>
   <ul>
    <li data-md>
     <p>Remove <code class="highlight"><c- n>execute_all</c-></code> and <code class="highlight"><c- n>execute_chunk</c-></code>. Replace with compile-time customization and a design discussion.</p>
    <li data-md>
     <p>Add design discussion about the approach we should take for customization and the extent to which the context should be implementation-defined.</p>
    <li data-md>
     <p>Add design discussion for an explicit <code class="highlight"><c- n>system_context</c-></code> class.</p>
    <li data-md>
     <p>Add design discussion about priorities.</p>
   </ul>
   <h3 class="heading settled" data-level="1.3" id="r2"><span class="secno">1.3. </span><span class="content">R2</span><a class="self-link" href="#r2"></a></h3>
   <ul>
    <li data-md>
     <p>Significant redesign to fit in <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a> model.</p>
    <li data-md>
     <p>Strictly limit to parallel progress without control over the level of parallelism.</p>
    <li data-md>
     <p>Remove direct support for task groups, delegating that to <code class="highlight"><c- n>async_scope</c-></code>.</p>
   </ul>
   <h3 class="heading settled" data-level="1.4" id="r1"><span class="secno">1.4. </span><span class="content">R1</span><a class="self-link" href="#r1"></a></h3>
   <ul>
    <li data-md>
     <p>Minor modifications</p>
   </ul>
   <h3 class="heading settled" data-level="1.5" id="r0"><span class="secno">1.5. </span><span class="content">R0</span><a class="self-link" href="#r0"></a></h3>
   <ul>
    <li data-md>
     <p>First revision</p>
   </ul>
   <h2 class="heading settled" data-level="2" id="introduction"><span class="secno">2. </span><span class="content">Introduction</span><a class="self-link" href="#introduction"></a></h2>
    <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a> describes a rounded set of primitives for asynchronous and parallel execution that give a firm grounding for the future.
However, the paper lacks a standard execution context and scheduler.
It has been broadly accepted that we need some sort of standard scheduler. 
   <p>As part of <a data-link-type="biblio" href="#biblio-p3109r0" title="A plan for std::execution for C++26">[P3109R0]</a>, <code class="highlight"><c- n>system_context</c-></code> was voted as a must-have for the initial release of senders/receivers.
It provides a convenient and scalable way of spawning concurrent work for the users of senders/receivers.</p>
   <p>As noted in <a data-link-type="biblio" href="#biblio-p2079r1" title="Parallel Executor">[P2079R1]</a>, an earlier revision of this paper, the <code class="highlight"><c- n>static_thread_pool</c-></code> included in later revisions of <a data-link-type="biblio" href="#biblio-p0443r14" title="A Unified Executors Proposal for C++">[P0443R14]</a> had many shortcomings.
This was removed from <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a> based on that and other input.</p>
   <p>One of the biggest problems with local thread pools is that they lead to CPU oversubscription.
This introduces a performance problem for complex systems that are composed from many independent parts.</p>
   <p>This revision updates <a data-link-type="biblio" href="#biblio-p2079r1" title="Parallel Executor">[P2079R1]</a> to match the structure of <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a>.
It aims to provide a simple, flexible, standard execution context that should be used as the basis for examples but should also scale for practical use cases.
It is a minimal design, with few constraints, and as such should be efficient to implement on top of something like a static thread pool, but also on top of system thread pools where fixing the number of threads diverges from efficient implementation goals.</p>
   <p>Unlike in earlier versions of this paper, we do not provide support for waiting on groups of tasks, delegating that to the separate <code class="highlight"><c- n>async_scope</c-></code> design in <a data-link-type="biblio" href="#biblio-p3149r2" title="async_scope — Creating scopes for non-sequential concurrency">[P3149R2]</a>, because that is not functionality specific to a system context.
Lifetime management in general should be considered delegated to <code class="highlight"><c- n>async_scope</c-></code>.</p>
   <p>The system context is of undefined size, supporting explicitly <em>parallel forward progress</em>.
By requiring only parallel forward progress, any created parallel context is able to be a view onto the underlying shared global context.
All instances of the <code class="highlight"><c- n>system_context</c-></code> share the same underlying execution context.
If the underlying context is a static thread pool, then all <code class="highlight"><c- n>system_context</c-></code>s should reference that same static thread pool.
This is important to ensure that applications can rely on constructing <code class="highlight"><c- n>system_context</c-></code>s as necessary, without spawning an ever increasing number of threads.
It also means that there is no isolation between <code class="highlight"><c- n>system_context</c-></code> instances, which people should be aware of when they use this functionality.
Note that if they rely strictly on parallel forward progress, this is not a problem, and is generally a safe way to develop applications.</p>
   <p>The minimal extensions to basic parallel forward progress are to support fundamental functionality that is necessary to make parallel algorithms work:</p>
   <ul>
    <li data-md>
     <p>Cancellation: work submitted through the parallel context must be cancellable.</p>
    <li data-md>
     <p>Forward progress delegation: we must be able to implement a blocking operation that ensures forward progress of a complex parallel algorithm without special cases.</p>
   </ul>
   <p>An implementation of <code class="highlight"><c- n>system_context</c-></code> <em>should</em> allow link-time or run-time replacement of the implementation such that the context may be replaced with an implementation that compiles and runs in a single-threaded process or that can be replaced with an appropriately configured system thread pool by an end-user.</p>
   <p>Some key concerns of this design are:</p>
   <ul>
    <li data-md>
     <p>Extensibility: being able to extend the design to work with new additions to the senders/receivers framework.</p>
    <li data-md>
     <p>Replaceability: allowing users to replace the default behavior provided by <code class="highlight"><c- n>system_context</c-></code>.</p>
    <li data-md>
     <p>Shareability: being able to share this system context across all binaries in the same process.</p>
    <li data-md>
     <p>Lifetime: as <code class="highlight"><c- n>system_context</c-></code> is a global resource, we need to pay attention to the lifetime of this resource.</p>
    <li data-md>
     <p>Performance: as we envision this to be used in many cases to spawn concurrent work, performance considerations are important.</p>
   </ul>
   <h2 class="heading settled" data-level="3" id="design"><span class="secno">3. </span><span class="content">Design</span><a class="self-link" href="#design"></a></h2>
   <h3 class="heading settled" data-level="3.1" id="system_context"><span class="secno">3.1. </span><span class="content"><code class="highlight"><c- n>system_context</c-></code></span><a class="self-link" href="#system_context"></a></h3>
   <p>The <code class="highlight"><c- n>system_context</c-></code> creates a view on some underlying execution context supporting <em>parallel forward progress</em>, with at least one thread of execution (which may be the main thread).
A <code class="highlight"><c- n>system_context</c-></code> must outlive any work launched on it.</p>
<pre class="language-cpp highlight"><c- k>class</c-> <c- nc>system_context</c-> <c- p>{</c->
<c- k>public</c-><c- o>:</c->
  <c- n>system_context</c-><c- p>();</c->
   <c- o>~</c-><c- n>system_context</c-><c- p>();</c->

  <c- n>system_context</c-><c- p>(</c-><c- k>const</c-> <c- n>system_context</c-><c- o>&amp;</c-><c- p>)</c-> <c- o>=</c-> <c- k>delete</c-><c- p>;</c->
  <c- n>system_context</c-><c- p>(</c-><c- n>system_context</c-><c- o>&amp;&amp;</c-><c- p>)</c-> <c- o>=</c-> <c- k>delete</c-><c- p>;</c->
  <c- n>system_context</c-><c- o>&amp;</c-> <c- k>operator</c-><c- o>=</c-><c- p>(</c-><c- k>const</c-> <c- n>system_context</c-><c- o>&amp;</c-><c- p>)</c-> <c- o>=</c-> <c- k>delete</c-><c- p>;</c->
  <c- n>system_context</c-><c- o>&amp;</c-> <c- k>operator</c-><c- o>=</c-><c- p>(</c-><c- n>system_context</c-><c- o>&amp;&amp;</c-><c- p>)</c-> <c- o>=</c-> <c- k>delete</c-><c- p>;</c->

  <c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_scheduler</c-> <c- n>get_scheduler</c-><c- p>();</c->
  <c- b>size_t</c-> <c- nf>max_concurrency</c-><c- p>()</c-> <c- k>const</c-> <c- k>noexcept</c-><c- p>;</c->
<c- p>};</c->
</pre>
   <ul>
    <li data-md>
     <p>On construction, the <code class="highlight"><c- n>system_context</c-></code> may initialize a shared system context, if it has not been previously initialized.</p>
    <li data-md>
     <p>To support sharing of an underlying system context, two <code class="highlight"><c- n>system_context</c-></code> objects do not guarantee task isolation.
 If work submitted by one can consume the thread pool, that can block progress of another.</p>
    <li data-md>
     <p>The <code class="highlight"><c- n>system_context</c-></code> is non-copyable and non-moveable.</p>
    <li data-md>
     <p>The <code class="highlight"><c- n>system_context</c-></code> must outlive work launched on it.
 If there is outstanding work at the point of destruction, <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>terminate</c-></code> will be called.</p>
    <li data-md>
     <p>The <code class="highlight"><c- n>system_context</c-></code> must outlive schedulers obtained from it.
 If there are outstanding schedulers at destruction time, this is undefined behavior.</p>
    <li data-md>
     <p>The lifetime of a <code class="highlight"><c- n>system_context</c-></code> must be fully contained in the lifetime of <code class="highlight"><c- n>main</c-><c- p>()</c-></code>.</p>
    <li data-md>
     <p><code class="highlight"><c- n>get_scheduler</c-></code> returns a <code class="highlight"><c- n>system_scheduler</c-></code> instance that holds a reference to the <code class="highlight"><c- n>system_context</c-></code>.</p>
    <li data-md>
     <p><code class="highlight"><c- n>max_concurrency</c-></code> will return a value representing the maximum number of threads the context may support.
 This is not a snapshot of the current number of threads, and may return <code class="highlight"><c- n>numeric_limits</c-><c- o>&lt;</c-><c- b>size_t</c-><c- o>>::</c-><c- n>max</c-></code>.</p>
   </ul>
   <h3 class="heading settled" data-level="3.2" id="system_scheduler"><span class="secno">3.2. </span><span class="content"><code class="highlight"><c- n>system_scheduler</c-></code></span><a class="self-link" href="#system_scheduler"></a></h3>
   <p>A <code class="highlight"><c- n>system_scheduler</c-></code> is a copyable handle to a <code class="highlight"><c- n>system_context</c-></code>. It is the means through which agents are launched on a <code class="highlight"><c- n>system_context</c-></code>.
The <code class="highlight"><c- n>system_scheduler</c-></code> instance does not have to outlive work submitted to it.
The <code class="highlight"><c- n>system_scheduler</c-></code> is technically implementation-defined, but must be nameable.
See later discussion for how this might work.</p>
<pre class="language-cpp highlight"><c- k>class</c-> <c- nc>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_scheduler</c-> <c- p>{</c->
<c- k>public</c-><c- o>:</c->
  <c- n>system_scheduler</c-><c- p>()</c-> <c- o>=</c-> <c- k>delete</c-><c- p>;</c->
  <c- o>~</c-><c- n>system_scheduler</c-><c- p>();</c->

  <c- n>system_scheduler</c-><c- p>(</c-><c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>);</c->
  <c- n>system_scheduler</c-><c- p>(</c-><c- n>system_scheduler</c-><c- o>&amp;&amp;</c-><c- p>);</c->
  <c- n>system_scheduler</c-><c- o>&amp;</c-> <c- k>operator</c-><c- o>=</c-><c- p>(</c-><c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>);</c->
  <c- n>system_scheduler</c-><c- o>&amp;</c-> <c- k>operator</c-><c- o>=</c-><c- p>(</c-><c- n>system_scheduler</c-><c- o>&amp;&amp;</c-><c- p>);</c->

  <c- b>bool</c-> <c- k>operator</c-><c- o>==</c-><c- p>(</c-><c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>)</c-> <c- k>const</c-> <c- k>noexcept</c-><c- p>;</c->

  <c- k>friend</c-> <c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_sender</c-> <c- n>tag_invoke</c-><c- p>(</c->
    <c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>schedule_t</c-><c- p>,</c-> <c- k>const</c-> <c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>)</c-> <c- k>noexcept</c-><c- p>;</c->
  <c- k>friend</c-> <c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>forward_progress_guarantee</c-> <c- nf>tag_invoke</c-><c- p>(</c->
    <c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>get_forward_progress_guarantee_t</c-><c- p>,</c->
    <c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>)</c-> <c- k>noexcept</c-><c- p>;</c->
  <c- k>friend</c-> <c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>bulk</c-><c- o>-</c-><c- n>sender</c-> <c- n>tag_invoke</c-><c- p>(</c->
    <c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>bulk_t</c-><c- p>,</c->
    <c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>,</c->
    <c- n>Sh</c-><c- o>&amp;&amp;</c-> <c- n>sh</c-><c- p>,</c->
    <c- n>F</c-><c- o>&amp;&amp;</c-> <c- n>f</c-><c- p>)</c-> <c- k>noexcept</c-><c- p>;</c->
<c- p>};</c->
</pre>
   <ul>
    <li data-md>
     <p><code class="highlight"><c- n>system_scheduler</c-></code> is not independently constructible, and must be obtained from a <code class="highlight"><c- n>system_context</c-></code>.
It is both move and copy constructible and assignable.</p>
    <li data-md>
     <p>Two <code class="highlight"><c- n>system_scheduler</c-></code>s compare equal if they share the same underlying implementation of <code class="highlight"><c- n>system_context</c-></code> (e.g., they can compare equal, even if they were generated from two different <code class="highlight"><c- n>system_context</c-></code> objects).</p>
    <li data-md>
     <p>A <code class="highlight"><c- n>system_scheduler</c-></code> has reference semantics with respect to its <code class="highlight"><c- n>system_context</c-></code>.
Calling any operation other than the destructor on a <code class="highlight"><c- n>system_scheduler</c-></code> after the <code class="highlight"><c- n>system_context</c-></code> it was created from
is destroyed is undefined behavior, and that operation may access freed memory.</p>
    <li data-md>
     <p>The <code class="highlight"><c- n>system_scheduler</c-></code>:</p>
     <ul>
      <li data-md>
       <p>satisfies the <code class="highlight"><c- n>scheduler</c-></code> concept and implements the <code class="highlight"><c- n>schedule</c-></code> customisation point to return an <code class="highlight"><c- n>implementation</c-><c- o>-</c-><c- n>defined</c-></code> <code class="highlight"><c- n>sender</c-></code> type.</p>
      <li data-md>
       <p>implements the <code class="highlight"><c- n>get_forward_progress_guarantee</c-></code> query to return <code class="highlight"><c- n>parallel</c-></code>.</p>
      <li data-md>
       <p>implements the <code class="highlight"><c- n>bulk</c-></code> CPO to customise the <code class="highlight"><c- n>bulk</c-></code> sender adapter such that:</p>
       <ul>
        <li data-md>
         <p>When <code class="highlight"><c- n>execution</c-><c- o>::</c-><c- n>set_value</c-><c- p>(</c-><c- n>r</c-><c- p>,</c-> <c- n>args</c-><c- p>...)</c-></code> is called on the created <code class="highlight"><c- n>receiver</c-></code>, an agent is created with parallel forward progress on the
underlying <code class="highlight"><c- n>system_context</c-></code> for each <code class="highlight"><c- n>i</c-></code> of type <code class="highlight"><c- n>Shape</c-></code> from <code class="highlight"><c- mi>0</c-></code> to <code class="highlight"><c- n>sh</c-></code>, where <code class="highlight"><c- n>sh</c-></code> is the shape parameter to the bulk call,
that calls <code class="highlight"><c- n>f</c-><c- p>(</c-><c- n>i</c-><c- p>,</c-> <c- n>args</c-><c- p>...)</c-></code>.</p>
       </ul>
     </ul>
    <li data-md>
     <p><code class="highlight"><c- n>schedule</c-></code> calls on a <code class="highlight"><c- n>system_scheduler</c-></code> are non-blocking operations.</p>
    <li data-md>
     <p>If the underlying <code class="highlight"><c- n>system_context</c-></code> is unable to make progress on work created through <code class="highlight"><c- n>system_scheduler</c-></code> instances, and the sender retrieved
from <code class="highlight"><c- n>scheduler</c-></code> is connected to a <code class="highlight"><c- n>receiver</c-></code> that supports the <code class="highlight"><c- n>get_delegatee_scheduler</c-></code> query, work may scheduled on the <code class="highlight"><c- n>scheduler</c-></code> returned by <code class="highlight"><c- n>get_delegatee_scheduler</c-></code> at the time of the call to <code class="highlight"><c- n>start</c-></code>, or at any later point before the work completes.</p>
   </ul>
   <h3 class="heading settled" data-level="3.3" id="system_sender"><span class="secno">3.3. </span><span class="content"><code class="highlight"><c- n>system_sender</c-></code></span><a class="self-link" href="#system_sender"></a></h3>
<pre class="language-cpp highlight"><c- k>class</c-> <c- nc>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_sender</c-> <c- p>{</c->
<c- k>public</c-><c- o>:</c->
  <c- k>friend</c-> <c- n>pair</c-><c- o>&lt;</c-><c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>system_scheduler</c-><c- p>,</c-> <c- n>delegatee_scheduler</c-><c- o>></c-> <c- n>tag_invoke</c-><c- p>(</c->
    <c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>get_completion_scheduler_t</c-><c- o>&lt;</c-><c- n>set_value_t</c-><c- o>></c-><c- p>,</c->
    <c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>)</c-> <c- k>noexcept</c-><c- p>;</c->
  <c- k>friend</c-> <c- n>pair</c-><c- o>&lt;</c-><c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>system_scheduler</c-><c- p>,</c-> <c- n>delegatee_scheduler</c-><c- o>></c-> <c- n>tag_invoke</c-><c- p>(</c->
    <c- n>std</c-><c- o>::</c-><c- n>execution</c-><c- o>::</c-><c- n>get_completion_scheduler_t</c-><c- o>&lt;</c-><c- n>set_stopped_t</c-><c- o>></c-><c- p>,</c->
    <c- k>const</c-> <c- n>system_scheduler</c-><c- o>&amp;</c-><c- p>)</c-> <c- k>noexcept</c-><c- p>;</c->

  <c- k>template</c-><c- o>&lt;</c-><c- n>receiver</c-> <c- n>R</c-><c- o>></c->
        <c- k>requires</c-> <c- n>receiver_of</c-><c- o>&lt;</c-><c- n>R</c-><c- o>></c->
  <c- k>friend</c-> <c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>operation_state</c->
    <c- n>tag_invoke</c-><c- p>(</c-><c- n>execution</c-><c- o>::</c-><c- n>connect_t</c-><c- p>,</c-> <c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_sender</c-><c- o>&amp;&amp;</c-><c- p>,</c-> <c- n>R</c-><c- o>&amp;&amp;</c-><c- p>);</c->

  <c- p>...</c->
<c- p>};</c->
</pre>
   <p><code class="highlight"><c- n>schedule</c-></code> on a <code class="highlight"><c- n>system_scheduler</c-></code> returns some implementation-defined <code class="highlight"><c- n>sender</c-></code> type.</p>
   <p>This sender satisfies the following properties:</p>
   <ul>
    <li data-md>
     <p>Implements the <code class="highlight"><c- n>get_completion_scheduler</c-></code> query for the value and done channel where it returns a type that is logically
a pair of an object that compares equal to itself, and a representation of delegatee scheduler that may be obtained from
receivers connected with the sender.</p>
    <li data-md>
     <p>If connected with a <code class="highlight"><c- n>receiver</c-></code> that supports the <code class="highlight"><c- n>get_stop_token</c-></code> query, if that <code class="highlight"><c- n>stop_token</c-></code> is stopped, operations
on which <code class="highlight"><c- n>start</c-></code> has been called, but are not yet running (and are hence not yet guaranteed to make progress) <strong>must</strong> complete with <code class="highlight"><c- n>set_stopped</c-></code> as soon as is practical.</p>
    <li data-md>
     <p><code class="highlight"><c- n>connect</c-></code>ing the <code class="highlight"><c- n>sender</c-></code> and calling <code class="highlight"><c- n>start</c-><c- p>()</c-></code> on the resulting operation state are non-blocking operations.</p>
   </ul>
   <h2 class="heading settled" data-level="4" id="design_considerations"><span class="secno">4. </span><span class="content">Design discussion and decisions</span><a class="self-link" href="#design_considerations"></a></h2>
   <h3 class="heading settled" data-level="4.1" id="drive_not_drive"><span class="secno">4.1. </span><span class="content">To drive or not to drive</span><a class="self-link" href="#drive_not_drive"></a></h3>
    On single-threaded systems (e.g., freestanding implementations) or on systems in which the main thread has special significance (e.g., to run the Qt main loop), it’s important to allow scheduling work on the main thread.
For this, we need the main thread to <em>drive</em> work execution. 
   <p>The earlier version of this paper, <a data-link-type="biblio" href="#biblio-p2079r2" title="System execution context">[P2079R2]</a>, included <code class="highlight"><c- n>execute_all</c-></code> and <code class="highlight"><c- n>execute_chunk</c-></code> operations to integrate with senders.
In this version we have removed them because they imply certain requirements of forward progress delegation on the system context and it is not clear whether or not they should be called.
We envision a separate paper that adds the support for drive-ability, which is decoupled by this paper.</p>
   <p>We can simplify this discussion to a single function:</p>
<pre class="highlight"><c- b>void</c-> <c- nf>drive</c-><c- p>(</c-><c- n>system_context</c-><c- o>&amp;</c-> <c- n>ctx</c-><c- p>,</c-> <c- n>sender</c-> <c- k>auto</c-> <c- n>snd</c-><c- p>);</c->
</pre>
   <p>Let’s assume we have a single-threaded environment, and a means of customising the <code class="highlight"><c- n>system_context</c-></code> for this environment.
We know we need a way to donate <code class="highlight"><c- n>main</c-></code>’s thread to this context, it is the only thread we have available.
Assuming that we want a <code class="highlight"><c- n>drive</c-></code> operation in some form, our choices are to:</p>
   <ul>
    <li data-md>
     <p>define our <code class="highlight"><c- n>drive</c-></code> operation, so that it is standard, and we use it on this system.</p>
    <li data-md>
     <p>or allow the customisation to define a custom <code class="highlight"><c- n>drive</c-></code> operation related to the specific single-threaded environment.</p>
   </ul>
   <p>With a standard <code class="highlight"><c- n>drive</c-></code> of this sort (or of the more complex design in <a data-link-type="biblio" href="#biblio-p2079r2" title="System execution context">[P2079R2]</a>) we might write an example to use it directly:</p>
<pre class="language-cpp highlight"><c- n>system_context</c-> <c- n>ctx</c-><c- p>;</c->
<c- k>auto</c-> <c- n>snd</c-> <c- o>=</c-> <c- n>on</c-><c- p>(</c-><c- n>ctx</c-><c- p>,</c-> <c- n>doWork</c-><c- p>());</c->
<c- n>drive</c-><c- p>(</c-><c- n>ctx</c-><c- p>,</c-> <c- n>std</c-><c- o>::</c-><c- n>move</c-><c- p>(</c-><c- n>snd</c-><c- p>));</c->
</pre>
   <p>Without drive, we rely on an <code class="highlight"><c- n>async_scope</c-></code> to spawn the work and some system-specific drive operation:</p>
<pre class="language-cpp highlight"><c- n>system_context</c-> <c- n>ctx</c-><c- p>;</c->
<c- n>async_scope</c-> <c- n>scope</c-><c- p>;</c->
<c- k>auto</c-> <c- n>snd</c-> <c- o>=</c-> <c- n>on</c-><c- p>(</c-><c- n>ctx</c-><c- p>,</c-> <c- n>doWork</c-><c- p>());</c->
<c- n>scope</c-><c- p>.</c-><c- n>spawn</c-><c- p>(</c-><c- n>std</c-><c- o>::</c-><c- n>move</c-><c- p>(</c-><c- n>snd</c-><c- p>));</c->
<c- n>custom_drive_operation</c-><c- p>(</c-><c- n>ctx</c-><c- p>);</c->
</pre>
   <p>Neither of the two variants is very portable.
The first variant requires applications that don’t care about drive-ability to call <code class="highlight"><c- n>drive</c-></code>, while the second variant requires custom pluming to tie the main thread with the system scheduler.</p>
   <p>We envision a new paper that adds support for a <em>main scheduler</em> similar to the <em>system scheduler</em>.
The main scheduler, for hosted implementations would be typically different than the system scheduler.
On the other hand, on freestanding implementations, the main scheduler and system scheduler can share the same underlying implementation, and both of them can execute work on the main thread; in this mode, the main scheduler is required to be driven, so that system scheduler can execute work.</p>
   <p>Keeping those two topic as separate papers allows to make progress independently.</p>
   <h3 class="heading settled" data-level="4.2" id="freestanding_implementations"><span class="secno">4.2. </span><span class="content">Freestanding implementations</span><a class="self-link" href="#freestanding_implementations"></a></h3>
   <p>This paper payed attention to freestanding implementations, but doesn’t make any wording proposals for them.
We express a strong desire for the system scheduler to work on freestanding implementations, but leave the details to a different paper.</p>
   <p>We envision that, a followup specification will ensure that the system scheduler will work in freestanding implementations by sharing the implementation with the main scheduler, which is driven by the main thread.</p>
   <h3 class="heading settled" data-level="4.3" id="replaceable_system_context"><span class="secno">4.3. </span><span class="content">Making <code class="highlight"><c- n>system_context</c-></code> implementation-defined and replaceable</span><a class="self-link" href="#replaceable_system_context"></a></h3>
    The system context aims to allow people to implement an application that is dependent only on parallel forward progress and to port it to a wide range of systems.
As long as an application does not rely on concurrency, and restricts itself to only the system context, we should be able to scale from single threaded systems to highly parallel systems. 
   <p>In the extreme, this might mean porting to an embedded system with a very specific idea of an execution context.
Such a system might not have a multi-threading support at all, and thus the system context not only runs with single thread,
but actually runs on the system’s only thread. We might build the context on top of a UI thread, or we might want to swap
out the system-provided implementation with one from a vendor (like Intel) with experience writing optimised threading
runtimes.</p>
   <p>The latter is also important for the composability of the existing code with the <code class="highlight"><c- n>system_context</c-></code>, i.e., if
Intel Threading building blocks (oneTBB) is used by somebody and they want to start using <code class="highlight"><c- n>system_context</c-></code> as well, it’s
likely that the users want to replace <code class="highlight"><c- n>system_context</c-></code> implementation with oneTBB because in that case they would have
one thread pool and work scheduler underneath.</p>
   <p>We need to allow customisation of the system context to cover this full range of cases.
For a whole platform this is relatively simple.
We assume that everything is an implementation-defined type.
The <code class="highlight"><c- n>system_context</c-></code> itself is a named type, but in practice is implementation-defined, in the same way that <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>vector</c-></code> is implementation-defined at the platform level.</p>
   <p>Other situations may offer a little less control.
If we wish Intel to be able to replace the system thread pool with TBB, or Adobe to customise the runtime that they use for all of Photoshop to adapt to their needs, we need  a different customisation mechanism.</p>
   <p>To achieve this we see options:</p>
   <ol>
    <li data-md>
     <p>Link-time replaceability. This could be achieved using weak symbols, or by choosing a runtime library to pull in using build options.</p>
    <li data-md>
     <p>Run-time replaceability. This could be achieved by subclassing and requiring certain calls to be made early in the process.</p>
    <li data-md>
     <p>Compile-time replaceability. This could be achieved by importing different headers, by macro definitions on the command line or various other mechanisms.</p>
   </ol>
   <p>Link-time replaceability has the following characteristics:</p>
   <ul>
    <li data-md>
     <p>Pro: we have precedence in the standard: this is similar to replacing <code class="highlight"><c- k>operator</c-> <c- k>new</c-></code>.</p>
    <li data-md>
     <p>Pro: more predictable, in that it can be guaranteed to be application-global.</p>
    <li data-md>
     <p>Pro: some of the type erasure and indirection can be removed in practice with link-time optimisation.</p>
    <li data-md>
     <p>Con: it requires defining the ABI and thus, in some cases, would require some type erasure and some inefficiency.</p>
    <li data-md>
     <p>Con: harder to get it correctly with shared libraries (e.g., DLLs might have different replaced versions of the system scheduler).</p>
    <li data-md>
     <p>Con: the replacement might depend on the order of linking.</p>
   </ul>
   <p>Run-time replaceability has the following characteristics:</p>
   <ul>
    <li data-md>
     <p>Pro: we have precedence in the standard: this is similar to <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>set_terminate</c-><c- p>()</c-></code>.</p>
    <li data-md>
     <p>Pro: easier to achieve consistent behavior on applications with shared libraries (e.g., Windows has the same version of C++ standard library in DLL).</p>
    <li data-md>
     <p>Pro: a program can have multiple implementations of system scheduler.</p>
    <li data-md>
     <p>Con: race conditions between replacing the system scheduler and using it to spawn work.</p>
    <li data-md>
     <p>Con: implies going over an ABI, and cannot be optimized at link-time.</p>
    <li data-md>
     <p>Con: different implementation may allocate resources for the system scheduler at startup, and then, at the start of main, the implementation is replaced (this is mainly a QOI issue).</p>
    <li data-md>
     <p>Con: requires strict lifetime and ownership control to be safe, and for the user to do the right thing explicitly.</p>
   </ul>
   <p>Compile-time replaceability has the following characteristics:</p>
   <ul>
    <li data-md>
     <p>Pro: users can do this with a type-def that can be used everywhere and switched.</p>
    <li data-md>
     <p>Con: potential problems with ODR violations.</p>
    <li data-md>
     <p>Con: doesn’t support shareability across different binaries of the same process</p>
   </ul>
   <p>The paper considers compile-time replaceability as not being a valid option because it easily breaks one of the fundamental
design principles of a <code class="highlight"><c- n>system_context</c-></code>, i.e. having one, shared, application-wide execution context, which avoids
oversubscription.</p>
   <p>We want to obtain feedback from different groups before moving forward with either link-time or run-time replaceability
design.</p>
   <h4 class="heading settled" data-level="4.3.1" id="bad_link_time_replaceability_examples"><span class="secno">4.3.1. </span><span class="content">Link-time replaceability is not perfect</span><a class="self-link" href="#bad_link_time_replaceability_examples"></a></h4>
   <p>The reason we want to also consider the run-time replaceability is because there are some examples (from the practical
standpoint) where link-time replaceability might lead to unexpected behavior. All the analysis
is done based on the <code class="highlight"><c- k>operator</c-> <c- k>new</c-><c- o>/</c-><c- k>operator</c-> <c- k>delete</c-></code> since it the good example in the C++ standard that has link-time
replaceability.</p>
   <h5 class="heading settled" data-level="4.3.1.1" id="example_on_linux"><span class="secno">4.3.1.1. </span><span class="content">Example on Linux</span><a class="self-link" href="#example_on_linux"></a></h5>
   <p>Let’s consider Linux and its toolchain (GCC, for instance).</p>
   <p>Imagine that we have two implementations of the ABI mentioned in <a href="#system_scheduler_abi">§ 4.5 ABI for system_scheduler</a> in some <code class="highlight"><c- p>.</c-><c- n>so</c-></code>. Let’s say one is <code class="highlight"><c- n>libsystem_scheduler_tbb</c-><c- p>.</c-><c- n>so</c-></code> and another one is <code class="highlight"><c- n>libsystem_scheduler_openmp</c-><c- p>.</c-><c- n>so</c-></code>. The problem is whichever library goes first
in the command line, it would be a system scheduler to use while the other one silently ignored.</p>
   <p>Please compare two different examples below:</p>
<pre class="highlight"><c- n>g</c-><c- o>++</c-> <c- n>my_app</c-><c- p>.</c-><c- n>cpp</c-> <c- o>-</c-><c- n>lsystem_scheduler_tbb</c-> <c- o>-</c-><c- n>lsystem_scheduler_openmp</c-> <c- c1>// TBB scheduler is going to be used</c->
</pre>
   <p>vs</p>
<pre class="highlight"><c- n>g</c-><c- o>++</c-> <c- n>my_app</c-><c- p>.</c-><c- n>cpp</c-> <c- o>-</c-><c- n>lsystem_scheduler_openmp</c-> <c- o>-</c-><c- n>lsystem_scheduler_tbb</c-> <c- c1>// OpenMP scheduler is going to be used</c->
</pre>
   <p>which might be unexpected by for the users.</p>
   <p>Of course, in the example above with the simple command line everything might look more or less clear but if someone has
the complex build system debugging such an issue might be because the possible scenario is that the correctness is not
affected, only performance is.</p>
   <h5 class="heading settled" data-level="4.3.1.2" id="example_on_windows"><span class="secno">4.3.1.2. </span><span class="content">Example on Windows</span><a class="self-link" href="#example_on_windows"></a></h5>
   <p>On Windows the situation is even worse.</p>
   <p>Imagine that you have the application and a DLL that implements the ABI from <a href="#system_scheduler_abi">§ 4.5 ABI for system_scheduler</a>. The problem is
when you link that very DLL with the application the symbols remain within the DLL and they do not replace the system
scheduler default implementation, which is even more unobvious for the users.</p>
   <h5 class="heading settled" data-level="4.3.1.3" id="replaceability_conclusion"><span class="secno">4.3.1.3. </span><span class="content">Conclusion</span><a class="self-link" href="#replaceability_conclusion"></a></h5>
   <p>While run-time replaceability has some drawbacks, it lacks the issues described above. When one would change system scheduler
with run-time replacement mechanism (if it will be the case), it would work predictably on the different operating systems,
similar to <code class="highlight"><c- n>set_terminate</c-></code> API.</p>
   <p>One of the potential mitigations of run-time replaceability issues (such as data races) is that we could say that <em>"the <code class="highlight"><c- n>system_scheduler</c-></code> shall be replaced only once and before any outstanding work submitted to it by the application in <code class="highlight"><c- n>main</c-></code>"</em> or something similar. It not a formal wording, of course; it’s an example to give some ruminations.</p>
   <h3 class="heading settled" data-level="4.4" id="extensibility"><span class="secno">4.4. </span><span class="content">Extensibility</span><a class="self-link" href="#extensibility"></a></h3>
   <p>The <code class="highlight"><c- n>std</c-><c- o>::</c-><c- n>execution</c-></code> framework is expected to grow over time.
We expect to add time-based scheduling, async I/O, priority-based scheduling, and other for now unforeseen functionality.
The <code class="highlight"><c- n>system_context</c-></code> framework needs to be designed in such a way that it allows for extensibility.</p>
   <p>Whatever the replaceability mechanism is, we need to ensure that new features can be added to the system context in a backwards-compatible manner.</p>
   <p>There are two levels in which we can extend the system context:</p>
   <ol>
    <li data-md>
     <p>Add more types of schedulers, beside the system scheduler.</p>
    <li data-md>
     <p>Add more features to the existing scheduler.</p>
   </ol>
   <p>The first type of extensibility can easily be solved by adding new getters for the new types of schedulers.
Different types of schedulers should be able to be replaced separately; e.g., one should be able to replace the I/O scheduler without replacing the system scheduler.
The discussed replaceability mechanisms support this.</p>
   <p>The second type of extensibility can also be easily achieved, but, at this point, it’s beside of the scope of this paper.
Next section provides more details.</p>
   <h3 class="heading settled" data-level="4.5" id="system_scheduler_abi"><span class="secno">4.5. </span><span class="content">ABI for <code class="highlight"><c- n>system_scheduler</c-></code></span><a class="self-link" href="#system_scheduler_abi"></a></h3>
   <p>A proper implementation of the system scheduler that meets all the goals expressed in the paper needs to be divided into two parts: "host" and "backend".
The host part implements the API defined in this paper and calls the backend for the actual implementation.
The backend provides the actual implementation of the system context (e.g., use Grand Central Dispatch or Windows Thread Pool).</p>
   <p>As we need to switch between different backend, we need a "stable" ABI between these two parts.</p>
   <p>While standardizing the ABI is going to be challenging, the authors believe that doing that would be beneficial to the users
because it creates the portable way of substituting <code class="highlight"><c- n>system_scheduler</c-></code> for every C++ standard library implementation and for
all OS, supporting modern C++ (Linux, Windows, etc.).</p>
   <p>Below you can see how the ABI might look like:</p>
<pre class="language-cpp highlight"><c- k>struct</c-> <c- nc>exec_system_scheduler_interface</c-> <c- p>{</c->
  <c- c1>/// The forward progress guarantee of the scheduler.</c->
  <c- c1>///</c->
  <c- c1>/// 0 == concurrent, 1 == parallel, 2 == weakly_parallel</c->
  <c- b>uint32_t</c-> <c- n>forward_progress_guarantee</c-><c- p>;</c->

  <c- c1>/// The size of the operation state object on the implementation side.</c->
  <c- b>uint32_t</c-> <c- n>schedule_operation_size</c-><c- p>;</c->
  <c- c1>/// The alignment of the operation state object on the implementation side.</c->
  <c- b>uint32_t</c-> <c- n>schedule_operation_alignment</c-><c- p>;</c->

  <c- c1>/// Schedules new work on the system scheduler, calling `cb` with `data` when the work can start.</c->
  <c- c1>/// Returns an object that should be passed to destruct_schedule_operation when the operation completes.</c->
  <c- b>void</c-><c- o>*</c-> <c- p>(</c-><c- o>*</c-><c- n>schedule</c-><c- p>)(</c->
    <c- k>struct</c-> <c- nc>exec_system_scheduler_interface</c-><c- o>*</c-> <c- d>/*self*/</c-><c- p>,</c->
    <c- b>void</c-><c- o>*</c-> <c- d>/*preallocated*/</c-><c- p>,</c->
    <c- b>uint32_t</c-> <c- d>/*psize*/</c-><c- p>,</c->
    <c- n>exec_system_context_completion_callback_t</c-> <c- d>/*cb*/</c-><c- p>,</c->
    <c- b>void</c-><c- o>*</c-> <c- d>/*data*/</c-><c- p>);</c->

  <c- c1>/// Destructs the operation state object.</c->
  <c- b>void</c-> <c- p>(</c-><c- o>*</c-><c- n>destruct_schedule_operation</c-><c- p>)(</c->
    <c- k>struct</c-> <c- nc>exec_system_scheduler_interface</c-><c- o>*</c-> <c- d>/*self*/</c-><c- p>,</c->
    <c- b>void</c-><c- o>*</c-> <c- d>/*operation*/</c-><c- p>);</c->

  <c- c1>/// The size of the operation state object on the implementation side.</c->
  <c- b>uint32_t</c-> <c- n>bulk_schedule_operation_size</c-><c- p>;</c->
  <c- c1>/// The alignment of the operation state object on the implementation side.</c->
  <c- b>uint32_t</c-> <c- n>bulk_schedule_operation_alignment</c-><c- p>;</c->

  <c- c1>/// Schedules new bulk work of size `size` on the system scheduler, calling `cb_item` with `data`</c->
  <c- c1>/// for indices in [0, `size`), and calling `cb` on general completion.</c->
  <c- c1>/// Returns the operation state object that should be passed to destruct_bulk_schedule_operation.</c->
  <c- b>void</c-><c- o>*</c-> <c- p>(</c-><c- o>*</c-><c- n>bulk_schedule</c-><c- p>)(</c->
    <c- k>struct</c-> <c- nc>exec_system_scheduler_interface</c-><c- o>*</c-> <c- d>/*self*/</c-><c- p>,</c->
    <c- b>void</c-><c- o>*</c-> <c- d>/*preallocated*/</c-><c- p>,</c->
    <c- b>uint32_t</c-> <c- d>/*psize*/</c-><c- p>,</c->
    <c- n>exec_system_context_completion_callback_t</c-> <c- d>/*cb*/</c-><c- p>,</c->
    <c- n>exec_system_context_bulk_item_callback_t</c-> <c- d>/*cb_item*/</c-><c- p>,</c->
    <c- b>void</c-><c- o>*</c-> <c- d>/*data*/</c-><c- p>,</c->
    <c- b>long</c-> <c- d>/*size*/</c-><c- p>);</c->

  <c- c1>/// Destructs the operation state object for a bulk_schedule.</c->
  <c- b>void</c-> <c- p>(</c-><c- o>*</c-><c- n>destruct_bulk_schedule_operation</c-><c- p>)(</c->
    <c- k>struct</c-> <c- nc>exec_system_scheduler_interface</c-><c- o>*</c-> <c- d>/*self*/</c-><c- p>,</c->
    <c- b>void</c-><c- o>*</c-> <c- d>/*operation*/</c-><c- p>);</c->
<c- p>};</c->
</pre>
   <p>This is just an example that is used in the current reference implementation. In principle, it can be C ABI, virtual
functions, whatever we agree on.</p>
   <p>The implementation of the ABI above can be found in <a href="https://github.com/NVIDIA/stdexec">stdexec</a> repository.</p>
   <p>The authors would like to obtain feedback from the C++ standard library implementers before advancing a proposal for
standardizing the ABI.</p>
   <h3 class="heading settled" data-level="4.6" id="shareability"><span class="secno">4.6. </span><span class="content">Shareability</span><a class="self-link" href="#shareability"></a></h3>
   <p>One of the motivations of this paper is to stop the proliferation of local thread pools, which can lead to CPU oversubscription.
If multiple binaries are used in the same process, we don’t want each binary to have its own implementation of system context.
Instead, we would want to share the same underlying implementation.</p>
   <p>The recommendation of this paper is to leave the details of shareability to be implementation-defined or unspecified.</p>
   <h3 class="heading settled" data-level="4.7" id="performance"><span class="secno">4.7. </span><span class="content">Performance</span><a class="self-link" href="#performance"></a></h3>
   <p>As discussed above, one possible approach to the system context is to implement link-time replaceability.
This implies moving across binary boundaries, over some defined API (which should be extensible).
A common approach for this is to have COM-like objects.
However, the problem with that approach is that it requires memory allocation, which might be a costly operation.
This becomes problematic if we aim to encourage programmers to use the system context for spawning work in a concurrent system.</p>
   <p>While there are some costs associated with implementing all the goals stated here, we want the implementation of the system context to be as efficient as possible.
For example, a good implementation should avoid memory allocation for the common case in which the default implementation is utilized for a platform.</p>
   <p>This paper cannot recommend the specific implementation techniques that should be used to maximize performance; these are considered Quality of Implementation (QOI) details.</p>
   <h3 class="heading settled" data-level="4.8" id="lifetime"><span class="secno">4.8. </span><span class="content">Lifetime</span><a class="self-link" href="#lifetime"></a></h3>
   <p>Underneath the <code class="highlight"><c- n>system_context</c-></code>, there is a singleton of some sort. We need to specify the lifetime of this object and everything that derives from it.</p>
   <p>The paper mandates that the lifetime of any <code class="highlight"><c- n>system_context</c-></code> to fully be contained the lifetime of <code class="highlight"><c- n>main</c-><c- p>()</c-></code>.</p>
   <p>During the design of this paper the authors considered a more relaxed model: allow the <code class="highlight"><c- n>system_context</c-></code> to be created before <code class="highlight"><c- n>main</c-><c- p>()</c-></code> (as part of static initialization), but still mandate that all access to cease before the end of <code class="highlight"><c- n>main</c-><c- p>()</c-></code>; this model is somehow similar to the Intel Threading building blocks (oneTBB) model. While the relaxed model can prove sometime useful, we considered it to be a dangerous path, for the following reasons:</p>
   <ul>
    <li data-md>
     <p>The scope of <code class="highlight"><c- n>system_context</c-></code> should be deterministic with respect to global static objects and main; this allows people to reason about the application.</p>
    <li data-md>
     <p>We want to guarantee the access to static objects to all the work spawned on <code class="highlight"><c- n>system_context</c-></code>.</p>
    <li data-md>
     <p>A global static constructor may add work on the <code class="highlight"><c- n>system_context</c-></code>, thus, it may block on the completion of that work anytime until destruction; this would imply possibly blocking the termination of the program, after <code class="highlight"><c- n>main</c-><c- p>()</c-></code> is complete.</p>
    <li data-md>
     <p>For replaceability: we want to guarantee the access to static objects for any replacement of <code class="highlight"><c- n>system_context</c-></code>.</p>
    <li data-md>
     <p>There may be circular dependencies between user-supplied <code class="highlight"><c- n>system_context</c-></code> and the system allocator.</p>
   </ul>
   <p>If we start with this stricter path, we can always relax it later. On other hand, if we start with a more relaxed model, it will be harder to make it stricter after being used in production.</p>
   <h3 class="heading settled" data-level="4.9" id="expose_system_context_name"><span class="secno">4.9. </span><span class="content">Need for the <code class="highlight"><c- n>system_context</c-></code> class</span><a class="self-link" href="#expose_system_context_name"></a></h3>
    Our goal is to expose a global shared context to avoid oversubscription of threads in the system and to efficiently share a system thread pool.
Underneath the <code class="highlight"><c- n>system_context</c-></code> there is a singleton of some sort, potentially owned by the OS. 
   <p>The question is how we expose the singleton.
We have a few obvious options:</p>
   <ul>
    <li data-md>
     <p>Explicit context objects, as we’ve described in R2 and R3 of this paper, where a <code class="highlight"><c- n>system_context</c-></code> is constructed as any other context might be, and refers to a singleton underneath.</p>
    <li data-md>
     <p>A global <code class="highlight"><c- n>get_system_context</c-><c- p>()</c-></code> function that obtains a <code class="highlight"><c- n>system_context</c-></code> object, or a reference to one, representing the singleton explicitly.</p>
    <li data-md>
     <p>A global <code class="highlight"><c- n>get_system_scheduler</c-><c- p>()</c-></code> function that obtains a scheduler from some singleton system context, but does not explicitly expose the context.</p>
   </ul>
   <p>The <code class="highlight"><c- n>get_system_context</c-><c- p>()</c-></code> function returning by value adds little, it’s equivalent to direct construction. <code class="highlight"><c- n>get_system_context</c-><c- p>()</c-></code> returning by reference and <code class="highlight"><c- n>get_system_scheduler</c-><c- p>()</c-></code> have a different lifetime semantic from directly constructed <code class="highlight"><c- n>system_context</c-></code>.</p>
   <p>The main reason for having an explicit by-value context is that we can reason about lifetimes.
If we only have schedulers, from <code class="highlight"><c- n>get_system_context</c-><c- p>().</c-><c- n>get_scheduler</c-><c- p>()</c-></code> or from <code class="highlight"><c- n>get_system_scheduler</c-><c- p>()</c-></code> then we have to think about how they affect the context lifetime.
We might want to reference count the context, to ensure it outlives the schedulers, but this adds cost to each scheduler use, and to any downstream sender produced from the scheduler as well that is logically dependent on the scheduler.
We could alternatively not reference count and assume the context outlives everything in the system, but that leads quickly to shutdown order questions and potential surprises.</p>
   <p>By making the context explicit we require users to drain their work before they drain the context.
In debug builds, at least, we can also add reference counting so that destruction of the context before work completes reports a clear error to ensure that people clean up.
That is harder to do if the context is destroyed at some point after main completes.
This lifetime question also applies to construction: we can lazily construct a thread pool before we first use a scheduler to it.</p>
   <p>For this reason, and consistency with other discussions about structured concurrency, we opt for an explicit context object here.</p>
   <h3 class="heading settled" data-level="4.10" id="priorities"><span class="secno">4.10. </span><span class="content">Priorities</span><a class="self-link" href="#priorities"></a></h3>
    It’s broadly accepted that we need some form of priorities to tweak the behaviour of the system context.
This paper does not include priorities, though early drafts of R2 did.
We had different designs in flight for how to achieve priorities and decided they could be added later in either approach. 
   <p>The first approach is to expand one or more of the APIs.
The obvious way to do this would be to add a priority-taking version of <code class="highlight"><c- n>system_context</c-><c- o>::</c-><c- n>get_scheduler</c-><c- p>()</c-></code>:</p>
<pre class="language-cpp highlight"><c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_scheduler</c-> <c- n>get_scheduler</c-><c- p>();</c->
<c- n>implementation</c-><c- o>-</c-><c- n>defined</c-><c- o>-</c-><c- n>system_scheduler</c-> <c- n>get_scheduler</c-><c- p>(</c-><c- n>priority_t</c-> <c- n>priority</c-><c- p>);</c->
</pre>
   <p>This approach would offer priorities at scheduler granularity and apply to large sections of a program at once.</p>
   <p>The other approach, which matches the receiver query approach taken elsewhere in <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a> is to add a <code class="highlight"><c- n>get_priority</c-><c- p>()</c-></code> query on the receiver, which, if available, passes a priority to the scheduler in the same way that we pass an <code class="highlight"><c- n>allocator</c-></code> or a <code class="highlight"><c- n>stop_token</c-></code>.
This would work at task granularity, for each <code class="highlight"><c- n>schedule</c-><c- p>()</c-></code> call that we connect a receiver to we might pass a different priority.</p>
   <p>In either case we can add the priority in a separate paper.
It is thus not urgent that we answer this question, but we include the discussion point to explain why they were removed from the paper.</p>
   <h3 class="heading settled" data-level="4.11" id="reference_implementation"><span class="secno">4.11. </span><span class="content">Reference implementation</span><a class="self-link" href="#reference_implementation"></a></h3>
   <p>The authors prepared a reference implementation in <a href="https://github.com/NVIDIA/stdexec">stdexec</a></p>
   <p>A few key points of the implementation:</p>
   <ul>
    <li data-md>
     <p>The implementation is divided into two parts: "host" and "backend". The host part implements the API defined in this paper and calls the backend for the actual implementation. The backend provides the actual implementation of the system context.</p>
    <li data-md>
     <p>Allows link-time replaceability for <code class="highlight"><c- n>system_scheduler</c-></code>. Provides examples on doing this.</p>
    <li data-md>
     <p>Defines a simple C API between the host and backend parts. This way, one can easily extend this interface when new features need to be added to <code class="highlight"><c- n>system_context</c-></code>.</p>
    <li data-md>
     <p>Uses preallocated storage on the host side, so that the default implementation doesn’t need to allocate memory on the heap when adding new work to <code class="highlight"><c- n>system_scheduler</c-></code>.</p>
    <li data-md>
     <p>Guarantees a lifetime of at least the duration of <code class="highlight"><c- n>main</c-><c- p>()</c-></code>.</p>
    <li data-md>
     <p>As the default implementation is created outside of the host part, it can be shared between multiple binaries in the same process.</p>
    <li data-md>
     <p>TODO: Use OS scheduler for implementation.</p>
   </ul>
   <h3 class="heading settled" data-level="4.12" id="addressing_feedback"><span class="secno">4.12. </span><span class="content">Addressing received feedback</span><a class="self-link" href="#addressing_feedback"></a></h3>
   <h4 class="heading settled" data-level="4.12.1" id="borrow_threads"><span class="secno">4.12.1. </span><span class="content">Allow for system context to borrow threads</span><a class="self-link" href="#borrow_threads"></a></h4>
    Early feedback on the paper from Sean Parent suggested a need for the system context to support a configuration where it carries no threads of its own and takes over the main thread.
While in <a data-link-type="biblio" href="#biblio-p2079r2" title="System execution context">[P2079R2]</a> we proposed <code class="highlight"><c- n>execute_chunk</c-></code> and <code class="highlight"><c- n>execute_all</c-></code>, these enforce a particular implementation on the underlying execution context.
Instead, we simplify the proposal by removing this functionality and assuming that it is implemented by link-time or run-time replacement of the context.
We assume that the underlying mechanism to drive the context, should one be necessary, is implementation-defined.
This allows for custom hooks into an OS thread pool, or a simple <code class="highlight"><c- n>drive</c-><c- p>()</c-></code> method in main. 
   <p>As we discussed previously, a separate paper is supposed to take care of the drive-ability aspect.</p>
   <h4 class="heading settled" data-level="4.12.2" id="wtp_and_gcd"><span class="secno">4.12.2. </span><span class="content">Allow implementations to use Grand Central Dispatch and Windows Thread Pool</span><a class="self-link" href="#wtp_and_gcd"></a></h4>
   <p>In the current form of the paper, we allow implementations to define the best choice for implementing the system context for a particular system.
This includes using Grand Central Dispatch on Apple platforms and Windows Thread Pool on Windows.</p>
   <p>In addition, we propose implementations to allow the replaceability of the system context implementation.
This means that users should be allowed to write their own system context implementations that depend on OS facilities or
a necessity to use some vendor (like Intel) specific solutions for parallelism.</p>
   <h4 class="heading settled" data-level="4.12.3" id="priorities_and_elastic_pools"><span class="secno">4.12.3. </span><span class="content">Priorities and elastic pools</span><a class="self-link" href="#priorities_and_elastic_pools"></a></h4>
   <p>Feedback from Sean Parent:</p>
   <blockquote>
    <p>There is so much in that proposal that is not specified. What requirements are placed on the system scheduler? Most system schedulers support priorities and are elastic (i.e., blocking in the system thread pool will spin up additional threads to some limit).</p>
   </blockquote>
   <p>The lack of details in the specification is intentional, allowing implementers to make the best compromises for each platform.
As different platforms have different needs, constraints, and optimization goals, the authors believe that it is in the best interest of the users to leave some of these details as Quality of Implementation (QOI) details.</p>
   <h4 class="heading settled" data-level="4.12.4" id="less_portability_with_implementation_defined"><span class="secno">4.12.4. </span><span class="content">Implementation-defined may make things less portable</span><a class="self-link" href="#less_portability_with_implementation_defined"></a></h4>
   <p>Some feedback gathered during discussions on this paper suggested that having many aspects of the paper to be implementation-defined would reduce the portability of the system context.</p>
   <p>While it is true that people that would want to replace the system scheduler will have a harder time doing so, this will not affect the users of the system scheduler.
They would still be able to the use system context and system scheduler without knowing the implementation details of those.</p>
   <p>We have a precedence in the C++ standard for this approach with the global allocator.</p>
   <h2 class="heading settled" data-level="5" id="open_questions"><span class="secno">5. </span><span class="content">Questions to ask LEWG/SG1/vendors</span><a class="self-link" href="#open_questions"></a></h2>
   <h3 class="heading settled" data-level="5.1" id="replaceability_question"><span class="secno">5.1. </span><span class="content">What type of replaceability we want?</span><a class="self-link" href="#replaceability_question"></a></h3>
   <p>Do we want link-time replaceability or run-time replaceability?</p>
   <h3 class="heading settled" data-level="5.2" id="standardize_system_scheduler_abi"><span class="secno">5.2. </span><span class="content">Do we want to standardize an ABI for <code class="highlight"><c- n>system_scheduler</c-></code> (as opposed to leaving this to be implementation defined)?</span><a class="self-link" href="#standardize_system_scheduler_abi"></a></h3>
   <p>Proposed answer: YES.</p>
   <p>To allow users to easily change on the scheduler, they need to know how to replace the system scheduler backend.
The best way to do that is if we standardize the interface that the system scheduler has.</p>
   <p>Tradeoffs:</p>
   <ul>
    <li data-md>
     <p>Pro: allow users to have a portable replacement mechanism of <code class="highlight"><c- n>system_scheduler</c-></code> across all standard library
implementations.</p>
    <li data-md>
     <p>Pro: allow users to react faster to new technologies (without needing to wait for a new C++ release cycle).</p>
     <ul>
      <li data-md>
       <p>I.e., similar to adopting <code class="highlight"><c- n>io_uring</c-></code>, which got heavy adoption in a short amount of time</p>
     </ul>
    <li data-md>
     <p>Pro: increased portability</p>
    <li data-md>
     <p>Con: slightly larger interface needed to be standardized, and this is not something common for the C++ standard.</p>
    <li data-md>
     <p>Con: Might leave C++ standard library implementors less freedom on best interfaces for the targeted platforms. It should
be possible to mitigate this Con by working with C++ standard library vendors and understanding their needs.</p>
   </ul>
   <h3 class="heading settled" data-level="5.3" id="system_scheduler_before_main"><span class="secno">5.3. </span><span class="content">Do we want to allow system scheduler to be used before start of <code class="highlight"><c- n>main</c-><c- p>()</c-></code> ?</span><a class="self-link" href="#system_scheduler_before_main"></a></h3>
   <p>Proposed answer: NO.
We believe that this would create more problems that it actually solves.</p>
   <h2 class="heading settled" data-level="6" id="examples"><span class="secno">6. </span><span class="content">Examples</span><a class="self-link" href="#examples"></a></h2>
    As a simple parallel scheduler we can use it locally, and <code class="highlight"><c- n>sync_wait</c-></code> on the work to make sure that it is complete.
With forward progress delegation this would also allow the scheduler to delegate work to the blocked thread.
This example is derived from the Hello World example in <a data-link-type="biblio" href="#biblio-p2300r9" title="`std::execution`">[P2300R9]</a>. Note that it only adds a well-defined context
object, and queries that for the scheduler.
Everything else is unchanged about the example. 
<pre class="language-cpp highlight"><c- k>using</c-> <c- k>namespace</c-> <c- nn>std</c-><c- o>::</c-><c- nn>execution</c-><c- p>;</c->

<c- n>system_context</c-> <c- n>ctx</c-><c- p>;</c->
<c- n>scheduler</c-> <c- k>auto</c-> <c- n>sch</c-> <c- o>=</c-> <c- n>ctx</c-><c- p>.</c-><c- n>scheduler</c-><c- p>();</c->

<c- n>sender</c-> <c- k>auto</c-> <c- n>begin</c-> <c- o>=</c-> <c- n>schedule</c-><c- p>(</c-><c- n>sch</c-><c- p>);</c->
<c- n>sender</c-> <c- k>auto</c-> <c- n>hi</c-> <c- o>=</c-> <c- n>then</c-><c- p>(</c-><c- n>begin</c-><c- p>,</c-> <c- p>[]{</c->
    <c- n>std</c-><c- o>::</c-><c- n>cout</c-> <c- o>&lt;&lt;</c-> <c- s>"Hello world! Have an int."</c-><c- p>;</c->
    <c- k>return</c-> <c- mi>13</c-><c- p>;</c->
<c- p>});</c->
<c- n>sender</c-> <c- k>auto</c-> <c- n>add_42</c-> <c- o>=</c-> <c- n>then</c-><c- p>(</c-><c- n>hi</c-><c- p>,</c-> <c- p>[](</c-><c- b>int</c-> <c- n>arg</c-><c- p>)</c-> <c- p>{</c-> <c- k>return</c-> <c- n>arg</c-> <c- o>+</c-> <c- mi>42</c-><c- p>;</c-> <c- p>});</c->

<c- k>auto</c-> <c- p>[</c-><c- n>i</c-><c- p>]</c-> <c- o>=</c-> <c- n>this_thread</c-><c- o>::</c-><c- n>sync_wait</c-><c- p>(</c-><c- n>add_42</c-><c- p>).</c-><c- n>value</c-><c- p>();</c->
</pre>
   <p>We can structure the same thing using <code class="highlight"><c- n>execution</c-><c- o>::</c-><c- n>on</c-></code>, which better matches structured concurrency:</p>
<pre class="language-cpp highlight"><c- k>using</c-> <c- k>namespace</c-> <c- nn>std</c-><c- o>::</c-><c- nn>execution</c-><c- p>;</c->

<c- n>system_context</c-> <c- n>ctx</c-><c- p>;</c->
<c- n>scheduler</c-> <c- k>auto</c-> <c- n>sch</c-> <c- o>=</c-> <c- n>ctx</c-><c- p>.</c-><c- n>scheduler</c-><c- p>();</c->

<c- n>sender</c-> <c- k>auto</c-> <c- n>hi</c-> <c- o>=</c-> <c- n>then</c-><c- p>(</c-><c- n>just</c-><c- p>(),</c-> <c- p>[]{</c->
    <c- n>std</c-><c- o>::</c-><c- n>cout</c-> <c- o>&lt;&lt;</c-> <c- s>"Hello world! Have an int."</c-><c- p>;</c->
    <c- k>return</c-> <c- mi>13</c-><c- p>;</c->
<c- p>});</c->
<c- n>sender</c-> <c- k>auto</c-> <c- n>add_42</c-> <c- o>=</c-> <c- n>then</c-><c- p>(</c-><c- n>hi</c-><c- p>,</c-> <c- p>[](</c-><c- b>int</c-> <c- n>arg</c-><c- p>)</c-> <c- p>{</c-> <c- k>return</c-> <c- n>arg</c-> <c- o>+</c-> <c- mi>42</c-><c- p>;</c-> <c- p>});</c->

<c- k>auto</c-> <c- p>[</c-><c- n>i</c-><c- p>]</c-> <c- o>=</c-> <c- n>this_thread</c-><c- o>::</c-><c- n>sync_wait</c-><c- p>(</c-><c- n>on</c-><c- p>(</c-><c- n>sch</c-><c- p>,</c-> <c- n>add_42</c-><c- p>)).</c-><c- n>value</c-><c- p>();</c->
</pre>
   <p>The <code class="highlight"><c- n>system_scheduler</c-></code> customises <code class="highlight"><c- n>bulk</c-></code>, so we can use <code class="highlight"><c- n>bulk</c-></code> dependent on the scheduler.
Here we use it in structured form using the parameterless <code class="highlight"><c- n>get_scheduler</c-></code> that retrieves the scheduler from the receiver, combined with <code class="highlight"><c- n>on</c-></code>:</p>
<pre class="language-cpp highlight"><c- k>auto</c-> <c- n>bar</c-><c- p>()</c-> <c- p>{</c->
  <c- k>return</c->
    <c- n>ex</c-><c- o>::</c-><c- n>let_value</c-><c- p>(</c->
      <c- n>ex</c-><c- o>::</c-><c- n>get_scheduler</c-><c- p>(),</c->          <c- c1>// Fetch scheduler from receiver.</c->
      <c- p>[](</c-><c- k>auto</c-> <c- n>current_sched</c-><c- p>)</c-> <c- p>{</c->
        <c- k>return</c-> <c- n>bulk</c-><c- p>(</c->
          <c- n>current_sched</c-><c- p>.</c-><c- n>schedule</c-><c- p>(),</c->
          <c- mi>1</c-><c- p>,</c->                        <c- c1>// Only 1 bulk task as a lazy way of making cout safe</c->
          <c- p>[](</c-><c- k>auto</c-> <c- n>idx</c-><c- p>){</c->
            <c- n>std</c-><c- o>::</c-><c- n>cout</c-> <c- o>&lt;&lt;</c-> <c- s>"Index: "</c-> <c- o>&lt;&lt;</c-> <c- n>idx</c-> <c- o>&lt;&lt;</c-> <c- s>"</c-><c- se>\n</c-><c- s>"</c-><c- p>;</c->
          <c- p>})</c->
      <c- p>});</c->
<c- p>}</c->

<c- b>void</c-> <c- n>foo</c-><c- p>()</c->
<c- p>{</c->
  <c- k>using</c-> <c- k>namespace</c-> <c- nn>std</c-><c- o>::</c-><c- nn>execution</c-><c- p>;</c->

  <c- n>system_context</c-> <c- n>ctx</c-><c- p>;</c->

  <c- k>auto</c-> <c- p>[</c-><c- n>i</c-><c- p>]</c-> <c- o>=</c-> <c- n>this_thread</c-><c- o>::</c-><c- n>sync_wait</c-><c- p>(</c->
    <c- n>on</c-><c- p>(</c->
      <c- n>ctx</c-><c- p>.</c-><c- n>scheduler</c-><c- p>(),</c->                <c- c1>// Start bar on the system_scheduler</c->
      <c- n>bar</c-><c- p>()))</c->                         <c- c1>// and propagate it through the receivers</c->
    <c- p>.</c-><c- n>value</c-><c- p>();</c->
<c- p>}</c->
</pre>
   <p>Use <code class="highlight"><c- n>async_scope</c-></code> and a custom system context implementation linked in to the process (through a mechanism undefined in the example).
This might be how a given platform exposes a custom context.
In this case we assume it has no threads of its own and has to take over the main thread through an custom <code class="highlight"><c- n>drive</c-><c- p>()</c-></code> operation that can be looped until a callback requests <code class="highlight"><c- n>exit</c-></code> on the context.</p>
<pre class="language-cpp highlight"><c- k>using</c-> <c- k>namespace</c-> <c- nn>std</c-><c- o>::</c-><c- nn>execution</c-><c- p>;</c->

<c- n>system_context</c-> <c- n>ctx</c-><c- p>;</c->

<c- b>int</c-> <c- n>result</c-> <c- o>=</c-> <c- mi>0</c-><c- p>;</c->

<c- p>{</c->
  <c- n>async_scope</c-> <c- n>scope</c-><c- p>;</c->
  <c- n>scheduler</c-> <c- k>auto</c-> <c- n>sch</c-> <c- o>=</c-> <c- n>ctx</c-><c- p>.</c-><c- n>scheduler</c-><c- p>();</c->

  <c- n>sender</c-> <c- k>auto</c-> <c- n>work</c-> <c- o>=</c->
    <c- n>then</c-><c- p>(</c-><c- n>just</c-><c- p>(),</c-> <c- p>[</c-><c- o>&amp;</c-><c- p>](</c-><c- k>auto</c-> <c- n>sched</c-><c- p>)</c-> <c- p>{</c->

      <c- b>int</c-> <c- n>val</c-> <c- o>=</c-> <c- mi>13</c-><c- p>;</c->

      <c- k>auto</c-> <c- n>print_sender</c-> <c- o>=</c-> <c- n>then</c-><c- p>(</c-><c- n>just</c-><c- p>(),</c-> <c- p>[</c-><c- n>val</c-><c- p>]{</c->
        <c- n>std</c-><c- o>::</c-><c- n>cout</c-> <c- o>&lt;&lt;</c-> <c- s>"Hello world! Have an int with value: "</c-> <c- o>&lt;&lt;</c-> <c- n>val</c-> <c- o>&lt;&lt;</c-> <c- s>"</c-><c- se>\n</c-><c- s>"</c-><c- p>;</c->
      <c- p>});</c->

      <c- c1>// spawn the print sender on sched to make sure it</c->
      <c- c1>// completes before shutdown</c->
      <c- n>scope</c-><c- p>.</c-><c- n>spawn</c-><c- p>(</c-><c- n>on</c-><c- p>(</c-><c- n>sch</c-><c- p>,</c-> <c- n>std</c-><c- o>::</c-><c- n>move</c-><c- p>(</c-><c- n>print_sender</c-><c- p>)));</c->

      <c- k>return</c-> <c- n>val</c-><c- p>;</c->
    <c- p>});</c->

  <c- n>scope</c-><c- p>.</c-><c- n>spawn</c-><c- p>(</c-><c- n>on</c-><c- p>(</c-><c- n>sch</c-><c- p>,</c-> <c- n>std</c-><c- o>::</c-><c- n>move</c-><c- p>(</c-><c- n>work</c-><c- p>)));</c->

  <c- c1>// This is custom code for a single-threaded context that we have replaced</c->
  <c- c1>// We need to drive it in main.</c->
  <c- c1>// It is not directly sender-aware, like any pre-existing work loop, but</c->
  <c- c1>// does provide an exit operation. We may call this from a callback chained</c->
  <c- c1>// after the scope becomes empty.</c->
  <c- c1>// We use a temporary terminal_scope here to separate the shut down</c->
  <c- c1>// operation and block for it at the end of main, knowing it will complete.</c->
  <c- n>async_scope</c-> <c- n>terminal_scope</c-><c- p>;</c->
  <c- n>terminal_scope</c-><c- p>.</c-><c- n>spawn</c-><c- p>(</c->
    <c- n>scope</c-><c- p>.</c-><c- n>on_empty</c-><c- p>()</c-> <c- o>|</c-> <c- n>then</c-><c- p>([](</c-><c- n>my_os</c-><c- o>::</c-><c- n>exit</c-><c- p>(</c-><c- n>ctx</c-><c- p>))));</c->
  <c- n>my_os</c-><c- o>::</c-><c- n>drive</c-><c- p>(</c-><c- n>ctx</c-><c- p>);</c->
  <c- n>this_thread</c-><c- o>::</c-><c- n>sync_wait</c-><c- p>(</c-><c- n>terminal_scope</c-><c- p>);</c->
<c- p>};</c->

<c- c1>// The scope ensured that all work is safely joined, so result contains 13</c->
<c- n>std</c-><c- o>::</c-><c- n>cout</c-> <c- o>&lt;&lt;</c-> <c- s>"Result: "</c-> <c- o>&lt;&lt;</c-> <c- n>result</c-> <c- o>&lt;&lt;</c-> <c- s>"</c-><c- se>\n</c-><c- s>"</c-><c- p>;</c->

<c- c1>// and destruction of the context is now safe</c->
</pre>
  </main>
<script>
(function() {
  "use strict";
  var collapseSidebarText = '<span aria-hidden="true">←</span> '
                          + '<span>Collapse Sidebar</span>';
  var expandSidebarText   = '<span aria-hidden="true">→</span> '
                          + '<span>Pop Out Sidebar</span>';
  var tocJumpText         = '<span aria-hidden="true">↑</span> '
                          + '<span>Jump to Table of Contents</span>';

  var sidebarMedia = window.matchMedia('screen and (min-width: 78em)');
  var autoToggle   = function(e){ toggleSidebar(e.matches) };
  if(sidebarMedia.addListener) {
    sidebarMedia.addListener(autoToggle);
  }

  function toggleSidebar(on) {
    if (on == undefined) {
      on = !document.body.classList.contains('toc-sidebar');
    }

    /* Don't scroll to compensate for the ToC if we're above it already. */
    var headY = 0;
    var head = document.querySelector('.head');
    if (head) {
      // terrible approx of "top of ToC"
      headY += head.offsetTop + head.offsetHeight;
    }
    var skipScroll = window.scrollY < headY;

    var toggle = document.getElementById('toc-toggle');
    var tocNav = document.getElementById('toc');
    if (on) {
      var tocHeight = tocNav.offsetHeight;
      document.body.classList.add('toc-sidebar');
      document.body.classList.remove('toc-inline');
      toggle.innerHTML = collapseSidebarText;
      if (!skipScroll) {
        window.scrollBy(0, 0 - tocHeight);
      }
      tocNav.focus();
      sidebarMedia.addListener(autoToggle); // auto-collapse when out of room
    }
    else {
      document.body.classList.add('toc-inline');
      document.body.classList.remove('toc-sidebar');
      toggle.innerHTML = expandSidebarText;
      if (!skipScroll) {
        window.scrollBy(0, tocNav.offsetHeight);
      }
      if (toggle.matches(':hover')) {
        /* Unfocus button when not using keyboard navigation,
           because I don't know where else to send the focus. */
        toggle.blur();
      }
    }
  }

  function createSidebarToggle() {
    /* Create the sidebar toggle in JS; it shouldn't exist when JS is off. */
    var toggle = document.createElement('a');
      /* This should probably be a button, but appearance isn't standards-track.*/
    toggle.id = 'toc-toggle';
    toggle.class = 'toc-toggle';
    toggle.href = '#toc';
    toggle.innerHTML = collapseSidebarText;

    sidebarMedia.addListener(autoToggle);
    var toggler = function(e) {
      e.preventDefault();
      sidebarMedia.removeListener(autoToggle); // persist explicit off states
      toggleSidebar();
      return false;
    }
    toggle.addEventListener('click', toggler, false);


    /* Get <nav id=toc-nav>, or make it if we don't have one. */
    var tocNav = document.getElementById('toc-nav');
    if (!tocNav) {
      tocNav = document.createElement('p');
      tocNav.id = 'toc-nav';
      /* Prepend for better keyboard navigation */
      document.body.insertBefore(tocNav, document.body.firstChild);
    }
    /* While we're at it, make sure we have a Jump to Toc link. */
    var tocJump = document.getElementById('toc-jump');
    if (!tocJump) {
      tocJump = document.createElement('a');
      tocJump.id = 'toc-jump';
      tocJump.href = '#toc';
      tocJump.innerHTML = tocJumpText;
      tocNav.appendChild(tocJump);
    }

    tocNav.appendChild(toggle);
  }

  var toc = document.getElementById('toc');
  if (toc) {
    createSidebarToggle();
    toggleSidebar(sidebarMedia.matches);

    /* If the sidebar has been manually opened and is currently overlaying the text
       (window too small for the MQ to add the margin to body),
       then auto-close the sidebar once you click on something in there. */
    toc.addEventListener('click', function(e) {
      if(e.target.tagName.toLowerCase() == "a" && document.body.classList.contains('toc-sidebar') && !sidebarMedia.matches) {
        toggleSidebar(false);
      }
    }, false);
  }
  else {
    console.warn("Can't find Table of Contents. Please use <nav id='toc'> around the ToC.");
  }

  /* Wrap tables in case they overflow */
  var tables = document.querySelectorAll(':not(.overlarge) > table.data, :not(.overlarge) > table.index');
  var numTables = tables.length;
  for (var i = 0; i < numTables; i++) {
    var table = tables[i];
    var wrapper = document.createElement('div');
    wrapper.className = 'overlarge';
    table.parentNode.insertBefore(wrapper, table);
    wrapper.appendChild(table);
  }

})();
</script>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-p0443r14">[P0443R14]
   <dd>Jared Hoberock, Michael Garland, Chris Kohlhoff, Chris Mysen, H. Carter Edwards, Gordon Brown, D. S. Hollman. <a href="https://wg21.link/p0443r14"><cite>A Unified Executors Proposal for C++</cite></a>. 15 September 2020. URL: <a href="https://wg21.link/p0443r14">https://wg21.link/p0443r14</a>
   <dt id="biblio-p2079r1">[P2079R1]
   <dd>Ruslan Arutyunyan, Michael Voss. <a href="https://wg21.link/p2079r1"><cite>Parallel Executor</cite></a>. 15 August 2020. URL: <a href="https://wg21.link/p2079r1">https://wg21.link/p2079r1</a>
   <dt id="biblio-p2079r2">[P2079R2]
   <dd>Lee Howes, Ruslan Arutyunyan, Michael Voss. <a href="https://wg21.link/p2079r2"><cite>System execution context</cite></a>. 15 January 2022. URL: <a href="https://wg21.link/p2079r2">https://wg21.link/p2079r2</a>
   <dt id="biblio-p2300r9">[P2300R9]
   <dd>Eric Niebler, Michał Dominiak, Georgy Evtushenko, Lewis Baker, Lucian Radu Teodorescu, Lee Howes, Kirk Shoop, Michael Garland, Bryce Adelstein Lelbach. <a href="https://wg21.link/p2300r9"><cite>`std::execution`</cite></a>. 2 April 2024. URL: <a href="https://wg21.link/p2300r9">https://wg21.link/p2300r9</a>
   <dt id="biblio-p3109r0">[P3109R0]
   <dd>Lewis Baker, Eric Niebler, Kirk Shoop, Lucian Radu. <a href="https://wg21.link/p3109r0"><cite>A plan for std::execution for C++26</cite></a>. 12 February 2024. URL: <a href="https://wg21.link/p3109r0">https://wg21.link/p3109r0</a>
   <dt id="biblio-p3149r2">[P3149R2]
   <dd>Ian Petersen, Ján Ondrušek; Jessica Wong; Kirk Shoop; Lee Howes; Lucian Radu Teodorescu;. <a href="https://wg21.link/p3149r2"><cite>async_scope — Creating scopes for non-sequential concurrency</cite></a>. 20 March 2024. URL: <a href="https://wg21.link/p3149r2">https://wg21.link/p3149r2</a>
  </dl>