<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://xinu.cs.mu.edu/index.php?action=history&amp;feed=atom&amp;title=Message_passing</id>
	<title>Message passing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://xinu.cs.mu.edu/index.php?action=history&amp;feed=atom&amp;title=Message_passing"/>
	<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;action=history"/>
	<updated>2026-06-15T16:29:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;diff=2708&amp;oldid=prev</id>
		<title>Amallen: updated this page to reflect new receive and recvclr functions</title>
		<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;diff=2708&amp;oldid=prev"/>
		<updated>2008-06-23T22:21:18Z</updated>

		<summary type="html">&lt;p&gt;updated this page to reflect new receive and recvclr functions&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 22:21, 23 June 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Message passing is one method used by XINU threads for interprocess communication. It allows threads to send individual messages to other threads by using the system calls &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;receive&lt;/del&gt;&amp;lt;/code&amp;gt;. Each thread has memory allocated for a single message in its thread control block specifically for messages sent and received using this method. This form of message passing should not be confused with the [[mailbox]] messaging queue system also used for interprocess communication.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Message passing is one method used by XINU threads for interprocess communication. It allows threads to send individual messages to other threads by using the system calls &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;, &lt;/ins&gt;and &amp;lt;code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;recvclr&lt;/ins&gt;&amp;lt;/code&amp;gt;. Each thread has memory allocated for a single message in its thread control block specifically for messages sent and received using this method. This form of message passing should not be confused with the [[mailbox]] messaging queue system also used for interprocess communication.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Upon creation, each thread is allocated memory in its thread control block for two fields which apply to this message passing system: a 4 byte (&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; type) message box to contain a single message sent to this thread, and a one byte flag (&amp;lt;code&amp;gt;bool&amp;lt;/code&amp;gt; type) to signal if there is an unreceived message waiting in that thread's message box.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Upon creation, each thread is allocated memory in its thread control block for two fields which apply to this message passing system: a 4 byte (&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; type) message box to contain a single message sent to this thread, and a one byte flag (&amp;lt;code&amp;gt;bool&amp;lt;/code&amp;gt; type) to signal if there is an unreceived message waiting in that thread's message box.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Threads use the functions &amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;receive&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bool block&lt;/del&gt;)&amp;lt;/code&amp;gt; to utilize this system of message passing.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Threads use the functions &amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &amp;lt;code&amp;gt;receive()&amp;lt;/code&amp;gt;, &lt;/ins&gt;and &amp;lt;code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;recvclr&lt;/ins&gt;()&amp;lt;/code&amp;gt; to utilize this system of message passing.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; delivers the message passed in as the parameter &amp;lt;code&amp;gt;msg&amp;lt;/code&amp;gt; to the message box in the thread control block of the thread with a thread id of &amp;lt;code&amp;gt;tid&amp;lt;/code&amp;gt;, also passed in as a parameter. &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; will always yield the processor by calling reschedule if the receiving thread was in a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; delivers the message passed in as the parameter &amp;lt;code&amp;gt;msg&amp;lt;/code&amp;gt; to the message box in the thread control block of the thread with a thread id of &amp;lt;code&amp;gt;tid&amp;lt;/code&amp;gt;, also passed in as a parameter. &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; will always yield the processor by calling reschedule if the receiving thread was in a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;receive(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bool block&lt;/del&gt;)&amp;lt;/code&amp;gt; returns the message waiting in the message box of the thread control block of the thread which called &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;. If there is no message waiting for the thread &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;then one of two things will happen depending on if the &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; call was blocking or non-blocking. If it was blocking &lt;/del&gt;then the thread will go into a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;) until a message is passed to the thread. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;If it was &lt;/del&gt;non-blocking &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;then &lt;/del&gt;&amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; will simply return &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;NULL &lt;/del&gt;signifying that there was no message waiting for the thread.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;receive()&amp;lt;/code&amp;gt; returns the message waiting in the message box of the thread control block of the thread which called &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;. If there is no message waiting for the thread then the thread will go into a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;) until a message is passed to the thread.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;recvclr()&amp;lt;/code&amp;gt; is a &lt;/ins&gt;non-blocking &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;version of &amp;lt;code&amp;gt;receive()&amp;lt;/code&amp;gt;. If there is a message waiting in the message box of the thread control block of the thread which called &lt;/ins&gt;&amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;it returns the message. If there is no message waiting for the thread, then it &lt;/ins&gt;will simply return &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt;, &lt;/ins&gt;signifying that there was no message waiting for the thread&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Notice that this does not block the thread that called &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; and will always immediately return either the message or &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt;&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Amallen</name></author>
		
	</entry>
	<entry>
		<id>https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;diff=2707&amp;oldid=prev</id>
		<title>Amallen: made changes to reflect the discovery that &quot;send&quot; is actually non-blocking</title>
		<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;diff=2707&amp;oldid=prev"/>
		<updated>2008-06-23T22:05:52Z</updated>

		<summary type="html">&lt;p&gt;made changes to reflect the discovery that &amp;quot;send&amp;quot; is actually non-blocking&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 22:05, 23 June 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Threads use the functions &amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive(bool block)&amp;lt;/code&amp;gt; to utilize this system of message passing.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Threads use the functions &amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive(bool block)&amp;lt;/code&amp;gt; to utilize this system of message passing.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; delivers the message passed in as the parameter &amp;lt;code&amp;gt;msg&amp;lt;/code&amp;gt; to the message box in the thread control block of the thread with a thread id of &amp;lt;code&amp;gt;tid&amp;lt;/code&amp;gt;, also passed in as a parameter. &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is always blocking and &lt;/del&gt;will always reschedule if the receiving thread was in a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; delivers the message passed in as the parameter &amp;lt;code&amp;gt;msg&amp;lt;/code&amp;gt; to the message box in the thread control block of the thread with a thread id of &amp;lt;code&amp;gt;tid&amp;lt;/code&amp;gt;, also passed in as a parameter. &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; will always &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;yield the processor by calling &lt;/ins&gt;reschedule if the receiving thread was in a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;receive(bool block)&amp;lt;/code&amp;gt; returns the message waiting in the message box of the thread control block of the thread which called &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;. If there is no message waiting for the thread then one of two things will happen depending on if the &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; call was blocking or non-blocking. If it was blocking then the thread will go into a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;) until a message is passed to the thread. If it was non-blocking then &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; will simply return NULL signifying that there was no message waiting for the thread.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;receive(bool block)&amp;lt;/code&amp;gt; returns the message waiting in the message box of the thread control block of the thread which called &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;. If there is no message waiting for the thread then one of two things will happen depending on if the &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; call was blocking or non-blocking. If it was blocking then the thread will go into a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;) until a message is passed to the thread. If it was non-blocking then &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; will simply return NULL signifying that there was no message waiting for the thread.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Amallen</name></author>
		
	</entry>
	<entry>
		<id>https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;diff=2676&amp;oldid=prev</id>
		<title>Amallen: New page: Message passing is one method used by XINU threads for interprocess communication. It allows threads to send individual messages to other threads by using the system calls &lt;code&gt;send&lt;/code...</title>
		<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Message_passing&amp;diff=2676&amp;oldid=prev"/>
		<updated>2008-06-09T22:25:01Z</updated>

		<summary type="html">&lt;p&gt;New page: Message passing is one method used by XINU threads for interprocess communication. It allows threads to send individual messages to other threads by using the system calls &amp;lt;code&amp;gt;send&amp;lt;/code...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Message passing is one method used by XINU threads for interprocess communication. It allows threads to send individual messages to other threads by using the system calls &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;. Each thread has memory allocated for a single message in its thread control block specifically for messages sent and received using this method. This form of message passing should not be confused with the [[mailbox]] messaging queue system also used for interprocess communication.&lt;br /&gt;
&lt;br /&gt;
Upon creation, each thread is allocated memory in its thread control block for two fields which apply to this message passing system: a 4 byte (&amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; type) message box to contain a single message sent to this thread, and a one byte flag (&amp;lt;code&amp;gt;bool&amp;lt;/code&amp;gt; type) to signal if there is an unreceived message waiting in that thread's message box.&lt;br /&gt;
&lt;br /&gt;
Threads use the functions &amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;receive(bool block)&amp;lt;/code&amp;gt; to utilize this system of message passing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;send(tid_typ tid, int msg)&amp;lt;/code&amp;gt; delivers the message passed in as the parameter &amp;lt;code&amp;gt;msg&amp;lt;/code&amp;gt; to the message box in the thread control block of the thread with a thread id of &amp;lt;code&amp;gt;tid&amp;lt;/code&amp;gt;, also passed in as a parameter. &amp;lt;code&amp;gt;send&amp;lt;/code&amp;gt; is always blocking and will always reschedule if the receiving thread was in a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;receive(bool block)&amp;lt;/code&amp;gt; returns the message waiting in the message box of the thread control block of the thread which called &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt;. If there is no message waiting for the thread then one of two things will happen depending on if the &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; call was blocking or non-blocking. If it was blocking then the thread will go into a state of waiting to receive a message (&amp;lt;code&amp;gt;THRRECV&amp;lt;/code&amp;gt;) until a message is passed to the thread. If it was non-blocking then &amp;lt;code&amp;gt;receive&amp;lt;/code&amp;gt; will simply return NULL signifying that there was no message waiting for the thread.&lt;/div&gt;</summary>
		<author><name>Amallen</name></author>
		
	</entry>
</feed>