<?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=Assignment%3A_Synchronization_and_Interprocess_Communication</id>
	<title>Assignment: Synchronization and Interprocess Communication - 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=Assignment%3A_Synchronization_and_Interprocess_Communication"/>
	<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Assignment:_Synchronization_and_Interprocess_Communication&amp;action=history"/>
	<updated>2026-06-15T16:06:00Z</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=Assignment:_Synchronization_and_Interprocess_Communication&amp;diff=3145&amp;oldid=prev</id>
		<title>Akoehler: /* Interprocess Communication */</title>
		<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Assignment:_Synchronization_and_Interprocess_Communication&amp;diff=3145&amp;oldid=prev"/>
		<updated>2009-03-24T19:15:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Interprocess Communication&lt;/span&gt;&lt;/span&gt;&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 19:15, 24 March 2009&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;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;[[Category:Student Built Xinu]]&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;[[Category:Student Built Xinu]]&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;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;= 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;= &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Synchronization and &lt;/ins&gt;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;div&gt;  Neither snow nor rain nor heat nor gloom of night stays these couriers from&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;  Neither snow nor rain nor heat nor gloom of night stays these couriers from&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;div&gt;  the swift completion of their appointed rounds.  &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;  the swift completion of their appointed rounds.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Akoehler</name></author>
		
	</entry>
	<entry>
		<id>https://xinu.cs.mu.edu/index.php?title=Assignment:_Synchronization_and_Interprocess_Communication&amp;diff=3144&amp;oldid=prev</id>
		<title>Akoehler: New page: Category:Student Built Xinu = Interprocess Communication =  Neither snow nor rain nor heat nor gloom of night stays these couriers from  the swift completion of their appointed rounds....</title>
		<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Assignment:_Synchronization_and_Interprocess_Communication&amp;diff=3144&amp;oldid=prev"/>
		<updated>2009-03-24T19:15:43Z</updated>

		<summary type="html">&lt;p&gt;New page: &lt;a href=&quot;/index.php?title=Category:Student_Built_Xinu&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Student Built Xinu (page does not exist)&quot;&gt;Category:Student Built Xinu&lt;/a&gt; = Interprocess Communication =  Neither snow nor rain nor heat nor gloom of night stays these couriers from  the swift completion of their appointed rounds....&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Student Built Xinu]]&lt;br /&gt;
= Interprocess Communication =&lt;br /&gt;
 Neither snow nor rain nor heat nor gloom of night stays these couriers from&lt;br /&gt;
 the swift completion of their appointed rounds. &lt;br /&gt;
 - USPS Unofficial Slogan&lt;br /&gt;
&lt;br /&gt;
This assignment is a [[Xinu]] assignment allowing the student to grow a more firm understanding of how an operating system works. This assignment is part of the [[Student Built Xinu]] track for professors that are [[Teaching With Xinu]]. Written answers to the analysis questions should be put into a file called &amp;lt;code&amp;gt;system/ANALYSIS.txt&amp;lt;/code&amp;gt; and submitted with the code. The entire directory containing the operating system should be turned in during the submission process.&lt;br /&gt;
&lt;br /&gt;
After completion of this assignment we will have a basic operating system with preemptive, priority scheduling of processes, and counting semaphores with wait queues as synchronization primitives and mailboxes for interprocess communication.&lt;br /&gt;
== Atomicity ==&lt;br /&gt;
In a system with preemption, we must now guard against being interrupted while in the middle of an atomic operation. There are many points in operating system code where an unfortunately timed interrupt could leave the system in an inconsistent state.&lt;br /&gt;
&lt;br /&gt;
For example, in the &amp;lt;code&amp;gt;resched()&amp;lt;/code&amp;gt; function, there are several lines of C code (which translate into many more lines of machine code) between the point where the outgoing running process is put back into the queue of ready processes and the point where an incoming process is dequeued and set to running. If an interrupt were to take place in the midst of this transition, the interrupt handling code might see the system in an inconsistent state, in which there doesn't seem to be a currently running process. For this reason, we consider process rescheduling to be atomic with respect to the rest of the operating system. The easiest way to enforce this is to temporarily disable interrupts during a critical, atomic section of code, and then reenable them when done.&lt;br /&gt;
&lt;br /&gt;
The new file &amp;lt;code&amp;gt;system/intr.S&amp;lt;/code&amp;gt; contains functions &amp;lt;code&amp;gt;enable()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;disable()&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;restore()&amp;lt;/code&amp;gt; for manipulating the master bit that enables processor interrupts. From this point forward, these functions must be used judiciously to guard atomic sections in the operating system functions you write.&lt;br /&gt;
== Preparation ==&lt;br /&gt;
First, make a fresh copy of your work thus far.&lt;br /&gt;
   cp -R &amp;lt;old Xinu directory&amp;gt; &amp;lt;new Xinu directory&amp;gt;&lt;br /&gt;
Untar the new project files on top of this new directory:&lt;br /&gt;
   tar xvzf &amp;lt;tar-ball location&amp;gt;&lt;br /&gt;
You should now see the new project files in with your old files. Be certain to make clean before compiling for the first time.&lt;br /&gt;
&lt;br /&gt;
== Semaphores ==&lt;br /&gt;
With this assignment you must learn about and understand classic semaphores before using them to implement the remainder of the assignment. An implementation of classic semaphores with waiting queues has been provided for you. Please examine and understand the implementation which can be found across several files including &amp;lt;code&amp;gt;include/semaphore.h&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;system/newsem.c&amp;lt;/code&amp;gt;, system/signal.c and &amp;lt;code&amp;gt;system/wait.c&amp;lt;/code&amp;gt;. As part of the analysis portion of this assignment, you will need to write a main file to show your understanding of semaphores.&lt;br /&gt;
&lt;br /&gt;
== Mailboxes ==&lt;br /&gt;
Using the provided semaphore structure, implement mailboxes as a means for interprocess communication. A structure outlining mailboxes can be found in &amp;lt;code&amp;gt;include/mailbox.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For completion of this assignment, your operating system should have a fully functioning mailbox system for interprocess communication. The files for the mailbox system can be found in the mailbox directory, including &amp;lt;code&amp;gt;mailbox/mailboxAlloc.c&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mailbox/mailboxFree.c&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mailbox/mailboxInit.c&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mailbox/mailboxReceive.c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mailbox/mailboxSend.c&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Analysis ==&lt;br /&gt;
For the analysis portion of this assignment, you will write two main files to show your understanding of the operating system. Previously, you would copy and paste your code over the given &amp;lt;code&amp;gt;system/main.c&amp;lt;/code&amp;gt; to run it. From this point on, you should add the test files to your Makefile (&amp;lt;code&amp;gt;compile/Makefile&amp;lt;/code&amp;gt;) to allow them to compile. Then, in &amp;lt;code&amp;gt;system/initialize.c&amp;lt;/code&amp;gt;, edit the process created when the system is initialized to use the test function instead of &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt;. &lt;br /&gt;
* Create a simple &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; program, with function called &amp;lt;code&amp;gt;main-hw6-q1&amp;lt;/code&amp;gt;, that has multiple processes that use a mutex locking semaphore to alter a shared resource. This program should be saved as &amp;lt;code&amp;gt;system/main-hw6-q1.c&amp;lt;/code&amp;gt; and should run properly when &amp;lt;code&amp;gt;system/initialize.c&amp;lt;/code&amp;gt; is altered to &amp;lt;code&amp;gt;create()&amp;lt;/code&amp;gt; a process for &amp;lt;code&amp;gt;main-hw6-q1()&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt;. &lt;br /&gt;
* Create another &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; program called &amp;lt;code&amp;gt;main-hw6-q2()&amp;lt;/code&amp;gt;, that uses mailboxes for effective interprocess communication. This program should be saved as &amp;lt;code&amp;gt;system/main-hw6-q2.c&amp;lt;/code&amp;gt; and should run properly when &amp;lt;code&amp;gt;system/initialize.c&amp;lt;/code&amp;gt; is altered to &amp;lt;code&amp;gt;create()&amp;lt;/code&amp;gt; a process for &amp;lt;code&amp;gt;main-hw6-q2()&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Give a situation in which mailboxes could be used to model a real-world problem; store your answer as Q3 in &amp;lt;code&amp;gt;system/ANALYSIS.txt&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Give a situation that will deadlock the system using your mailbox implementation. Why does it deadlock? What additional things might be added to the mailbox system or the operating system in general to fix this deadlock situation? Store your answers as Q4 in &amp;lt;code&amp;gt;system/ANALYSIS.txt&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Akoehler</name></author>
		
	</entry>
</feed>