<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Operating_Systems_2026F%3A_Assignment_3</id>
	<title>Operating Systems 2026F: Assignment 3 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Operating_Systems_2026F%3A_Assignment_3"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;action=history"/>
	<updated>2026-11-16T21:37:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25268&amp;oldid=prev</id>
		<title>Soma at 17:53, 14 November 2026</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25268&amp;oldid=prev"/>
		<updated>2026-11-14T17:53:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:53, 14 November 2026&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=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;This assignment is not yet finalized.&#039;&#039;&#039;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 23, 2026. There are 20 points in 7 questions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 23, 2026. There are 20 points in 7 questions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25243&amp;oldid=prev</id>
		<title>Soma at 22:40, 13 November 2026</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25243&amp;oldid=prev"/>
		<updated>2026-11-13T22:40:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:40, 13 November 2026&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=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;#039;&amp;#039;&amp;#039;This assignment is not yet finalized.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;#039;&amp;#039;&amp;#039;This assignment is not yet finalized.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 23, 2026. There are &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;?? &lt;/del&gt;points in &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;?? &lt;/del&gt;questions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 23, 2026. There are &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;20 &lt;/ins&gt;points in &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;7 &lt;/ins&gt;questions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &amp;quot;comp3000-a3-&amp;lt;username&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be properly recorded.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &amp;quot;comp3000-a3-&amp;lt;username&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be properly recorded.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25242&amp;oldid=prev</id>
		<title>Soma at 22:40, 13 November 2026</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25242&amp;oldid=prev"/>
		<updated>2026-11-13T22:40:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:40, 13 November 2026&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=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&#039;&#039;&#039;This assignment is &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;still being developed&lt;/del&gt;.&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&#039;&#039;&#039;This assignment is &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;not yet finalized&lt;/ins&gt;.&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 23, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 23, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25241&amp;oldid=prev</id>
		<title>Soma: /* Questions */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25241&amp;oldid=prev"/>
		<updated>2026-11-13T22:39:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Questions&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:39, 13 November 2026&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-l24&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;li&amp;gt;[4] How could you change &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt; so that with the -x option it only copies a file if the destination is a different filesystem than the source? Why does your solution work? How did you test it?&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;li&amp;gt;[4] How could you change &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt; so that with the -x option it only copies a file if the destination is a different filesystem than the source? Why does your solution work? How did you test it?&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;li&amp;gt;[2] Does &amp;lt;tt&amp;gt;3000cp-rendezvous&amp;lt;/tt&amp;gt; work consistently? How did you test it? Note that you can make arbitrarily sized random files using the dd command. For example, &amp;lt;tt&amp;gt;dd if=/dev/urandom of=testfile bs=4096 count=4&amp;lt;/tt&amp;gt; will produce a file with exactly 16,384 random bytes.&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;li&amp;gt;[2] Does &amp;lt;tt&amp;gt;3000cp-rendezvous&amp;lt;/tt&amp;gt; work consistently? How did you test it? Note that you can make arbitrarily sized random files using the dd command. For example, &amp;lt;tt&amp;gt;dd if=/dev/urandom of=testfile bs=4096 count=4&amp;lt;/tt&amp;gt; will produce a file with exactly 16,384 random bytes.&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;li&amp;gt;[4] How could you modify &amp;lt;tt&amp;gt;3000cp-rendezvous&amp;lt;tt&amp;gt; so it used the same timeout strategy as &amp;lt;tt&amp;gt;3000pc-rendezvous-timeout&amp;lt;/tt&amp;gt;? Does the modified version behave significantly differently from the original? At minimum, present timing test results.&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;li&amp;gt;[4] How could you modify &amp;lt;tt&amp;gt;3000cp-rendezvous&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/&lt;/ins&gt;tt&amp;gt; so it used the same timeout strategy as &amp;lt;tt&amp;gt;3000pc-rendezvous-timeout&amp;lt;/tt&amp;gt;? Does the modified version behave significantly differently from the original? At minimum, present timing test results.&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;/ol&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;/ol&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25240&amp;oldid=prev</id>
		<title>Soma: /* Questions */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25240&amp;oldid=prev"/>
		<updated>2026-11-13T22:39:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Questions&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:39, 13 November 2026&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-l18&quot;&gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;ol&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;ol&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;li&amp;gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1&lt;/del&gt;] &amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;li&amp;gt;[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2&lt;/ins&gt;] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The 3000cp programs copy a file from source to destination. The current versions overwrite the destination file if it already exists. How could you make &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt; generate an error if the destination already exists?&amp;lt;/li&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;li&amp;gt;[2] On lines 128 and 131, &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt; calls close. Are these calls important? Why?&amp;lt;/li&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;li&amp;gt;[2] How could you change &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt; so the destination file has the same permissions as the source file, always?&amp;lt;/li&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;li&amp;gt;[4] How could you make &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt;, with the -u option, make the destination file&#039;s owner and group be the same as the original file, no matter what those were for the original file? How could you make this version work properly if called by any user?&amp;lt;/li&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;li&amp;gt;[4] How could you change &amp;lt;tt&amp;gt;3000cp-fifo&amp;lt;/tt&amp;gt; so that with the -x option it only copies a file if the destination is a different filesystem than the source? Why does your solution work? How did you test it?&amp;lt;/li&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;li&amp;gt;[2] Does &amp;lt;tt&amp;gt;3000cp-rendezvous&amp;lt;/tt&amp;gt; work consistently? How did you test it? Note that you can make arbitrarily sized random files using the dd command. For example, &amp;lt;tt&amp;gt;dd if=/dev/urandom of=testfile bs=4096 count=4&amp;lt;/tt&amp;gt; will produce a file with exactly 16,384 random bytes.&amp;lt;/li&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;li&amp;gt;[4] How could you modify &amp;lt;tt&amp;gt;3000cp-rendezvous&amp;lt;tt&amp;gt; so it used the same timeout strategy as &amp;lt;tt&amp;gt;3000pc-rendezvous-timeout&amp;lt;/tt&amp;gt;? Does the modified version behave significantly differently from the original? At minimum, present timing test results.&lt;/ins&gt;&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;/ol&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;/ol&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25239&amp;oldid=prev</id>
		<title>Soma at 22:13, 13 November 2026</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25239&amp;oldid=prev"/>
		<updated>2026-11-13T22:13:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:13, 13 November 2026&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=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;#039;&amp;#039;&amp;#039;This assignment is still being developed.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;#039;&amp;#039;&amp;#039;This assignment is still being developed.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;Please submit the answers to the following questions via Brightspace by November &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;18&lt;/del&gt;, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;Please submit the answers to the following questions via Brightspace by November &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;23&lt;/ins&gt;, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &amp;quot;comp3000-a3-&amp;lt;username&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be properly recorded.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &amp;quot;comp3000-a3-&amp;lt;username&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be properly recorded.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25238&amp;oldid=prev</id>
		<title>Soma at 21:36, 13 November 2026</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25238&amp;oldid=prev"/>
		<updated>2026-11-13T21:36:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:36, 13 November 2026&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=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&#039;&#039;&#039;This assignment &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;isn&#039;t yet finalized&lt;/del&gt;.&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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;&#039;&#039;&#039;This assignment &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is still being developed&lt;/ins&gt;.&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25237&amp;oldid=prev</id>
		<title>Soma at 21:35, 13 November 2026</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25237&amp;oldid=prev"/>
		<updated>2026-11-13T21:35:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:35, 13 November 2026&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 colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;This assignment isn&#039;t yet finalized.&#039;&#039;&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; 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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; 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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25236&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.  Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &quot;comp3000-a3-&lt;username&gt;.txt&quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be pr...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2026F:_Assignment_3&amp;diff=25236&amp;oldid=prev"/>
		<updated>2026-11-13T21:34:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.  Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &amp;quot;comp3000-a3-&amp;lt;username&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be pr...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Please submit the answers to the following questions via Brightspace by November 18, 2026. There are ?? points in ?? questions.&lt;br /&gt;
&lt;br /&gt;
Submit your answers as a plain text file following [https://homeostasis.scs.carleton.ca/~soma/os-2026f/templates/comp3000-a3-template.txt this template].  Name your answer file &amp;quot;comp3000-a3-&amp;lt;username&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username).  Please make sure to use your correct student ID number otherwise your grades may not be properly recorded.&lt;br /&gt;
&lt;br /&gt;
Your answers will be parsed by a script in order to help with grading so please preserve the format of the template.  No other formats will be accepted.&lt;br /&gt;
&lt;br /&gt;
Note that the file should be a UNIX text file, not a Windows text file (so LF line endings).  See the [https://en.wikipedia.org/wiki/Text_file Wikipedia page on text files] to learn more.  Most modern text editors can convert between different types of text files.  Alternately, install the program &amp;lt;tt&amp;gt;dos2unix&amp;lt;/tt&amp;gt; on the VM to convert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;You may use [https://homeostasis.scs.carleton.ca/~soma/os-2026f/validators/a3-validator.html this validator page] to make sure your answer file is properly named and formatted.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don&amp;#039;t forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.&lt;br /&gt;
&lt;br /&gt;
==Questions==&lt;br /&gt;
&lt;br /&gt;
Please answer the following questions about the code below. Note that your code changes should make use of existing program functionality, either from this assignment&amp;#039;s code or code from the Tutorials, and should require adding as little code new as possible. Solutions that implement functionality from scratch where not needed will not receive credit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[1] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&lt;br /&gt;
Source: [https://homeostasis.scs.carleton.ca/~soma/os-2026f/code/3000cp.tar.gz .tar.gz], [https://homeostasis.scs.carleton.ca/~soma/os-2026f/code/3000cp.zip .zip]&lt;br /&gt;
&lt;br /&gt;
===[https://homeostasis.scs.carleton.ca/~soma/os-2026f/code/3000cp-fifo.c 3000cp-fifo.c]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
/* 3000cp-fifo.c  Simple producer-consumer with a fifo&lt;br /&gt;
 * Original Version Copyright (C) 2026  Anil Somayaji&lt;br /&gt;
 *&lt;br /&gt;
 * This program is free software: you can redistribute it and/or modify&lt;br /&gt;
 * it under the terms of the GNU General Public License as published by&lt;br /&gt;
 * the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
 * (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This program is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 * GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU General Public License&lt;br /&gt;
 * along with this program.  If not, see &amp;lt;https://www.gnu.org/licenses/&amp;gt;. */&lt;br /&gt;
&lt;br /&gt;
/* You really shouldn&amp;#039;t be incorporating parts of this in any other code,&lt;br /&gt;
   it is meant for teaching, not production */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/mman.h&amp;gt;&lt;br /&gt;
#include &amp;lt;errno.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
#include &amp;lt;fcntl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define BUFSIZE 4096&lt;br /&gt;
&lt;br /&gt;
void report_error(char *error)&lt;br /&gt;
{&lt;br /&gt;
        fprintf(stderr, &amp;quot;Error: %s\n&amp;quot;, error);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void usage_exit(char *progname)&lt;br /&gt;
{&lt;br /&gt;
        fprintf(stderr,&lt;br /&gt;
                &amp;quot;Usage: %s &amp;lt;source file&amp;gt; &amp;lt;dest file&amp;gt;\n&amp;quot;,&lt;br /&gt;
                progname);&lt;br /&gt;
        exit(-1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void read_file(char *fn, int out_fd)&lt;br /&gt;
{&lt;br /&gt;
        char buf[BUFSIZE];&lt;br /&gt;
        int in_fd;&lt;br /&gt;
        ssize_t read_count, write_count;&lt;br /&gt;
&lt;br /&gt;
        in_fd = open(fn, O_RDONLY);&lt;br /&gt;
&lt;br /&gt;
        if (in_fd == -1) {&lt;br /&gt;
                report_error(&amp;quot;Couldn&amp;#039;t open file for reading\n&amp;quot;);&lt;br /&gt;
                close(out_fd);&lt;br /&gt;
                exit(-1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        while ((read_count = read(in_fd, buf, BUFSIZE)) &amp;gt; 0) {&lt;br /&gt;
                write_count = write(out_fd, buf, read_count);&lt;br /&gt;
                if (write_count != read_count) {&lt;br /&gt;
                        report_error(&amp;quot;Problem sending data to writer.&amp;quot;);&lt;br /&gt;
                        close(out_fd);&lt;br /&gt;
                        exit(-1);&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        close(in_fd);&lt;br /&gt;
        close(out_fd);&lt;br /&gt;
        printf(&amp;quot;File successfully read and sent.\n&amp;quot;);&lt;br /&gt;
        exit(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void write_file(char *fn, int in_fd)&lt;br /&gt;
{&lt;br /&gt;
        char buf[BUFSIZE];&lt;br /&gt;
        int out_fd;&lt;br /&gt;
        ssize_t read_count, write_count;&lt;br /&gt;
&lt;br /&gt;
        out_fd = creat(fn, 0666);&lt;br /&gt;
&lt;br /&gt;
        if (out_fd == -1) {&lt;br /&gt;
                report_error(&amp;quot;Couldn&amp;#039;t open file for writing\n&amp;quot;);&lt;br /&gt;
                close(in_fd);&lt;br /&gt;
                exit(-1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        while ((read_count = read(in_fd, buf, BUFSIZE)) &amp;gt; 0) {&lt;br /&gt;
                write_count = write(out_fd, buf, read_count);&lt;br /&gt;
                if (write_count != read_count) {&lt;br /&gt;
                        report_error(&amp;quot;Problem writing file to disk.&amp;quot;);&lt;br /&gt;
                        exit(-1);&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        close(in_fd);&lt;br /&gt;
        close(out_fd);&lt;br /&gt;
        printf(&amp;quot;File successfully received and copied.\n&amp;quot;);&lt;br /&gt;
        exit(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
        int pid;&lt;br /&gt;
        int pipefd[2];&lt;br /&gt;
        char *source_fn, *dest_fn;&lt;br /&gt;
&lt;br /&gt;
        if (argc &amp;lt; 3) {&lt;br /&gt;
                if (argc &amp;lt; 2) {&lt;br /&gt;
                        report_error(&amp;quot;no command line&amp;quot;);&lt;br /&gt;
                        usage_exit(argv[0]);&lt;br /&gt;
                } else {&lt;br /&gt;
                        report_error(&amp;quot;Not enough arguments&amp;quot;);&lt;br /&gt;
                        usage_exit(argv[0]);&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        source_fn = argv[1];&lt;br /&gt;
        dest_fn = argv[2];&lt;br /&gt;
&lt;br /&gt;
        if (pipe(pipefd)) {&lt;br /&gt;
                report_error(&amp;quot;Unable to open pipe&amp;quot;);&lt;br /&gt;
                exit(-1);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        pid = fork();&lt;br /&gt;
        &lt;br /&gt;
        if (pid == 0) {&lt;br /&gt;
                close(pipefd[0]);&lt;br /&gt;
                read_file(source_fn, pipefd[1]);&lt;br /&gt;
        } else {&lt;br /&gt;
                close(pipefd[1]);&lt;br /&gt;
                write_file(dest_fn, pipefd[0]);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return -1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[https://homeostasis.scs.carleton.ca/~soma/os-2026f/code/3000cp-rendezvous.c 3000cp-rendezvous.c]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; line&amp;gt;&lt;br /&gt;
/* 3000cp-rendezvous.c  Simple producer-consumer with shared memory&lt;br /&gt;
 * Copyright (C) 2026  Anil Somayaji&lt;br /&gt;
 * based on code Copyright (C) 2020  William Findlay&lt;br /&gt;
 *&lt;br /&gt;
 * This program is free software: you can redistribute it and/or modify&lt;br /&gt;
 * it under the terms of the GNU General Public License as published by&lt;br /&gt;
 * the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
 * (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This program is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 * GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU General Public License&lt;br /&gt;
 * along with this program.  If not, see &amp;lt;https://www.gnu.org/licenses/&amp;gt;. */&lt;br /&gt;
&lt;br /&gt;
/* You really shouldn&amp;#039;t be incorporating parts of this in any other code,&lt;br /&gt;
   it is meant for teaching, not production */&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/stat.h&amp;gt;&lt;br /&gt;
#include &amp;lt;fcntl.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/mman.h&amp;gt;&lt;br /&gt;
#include &amp;lt;errno.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;pthread.h&amp;gt;&lt;br /&gt;
#include &amp;lt;semaphore.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define QUEUESIZE 32&lt;br /&gt;
#define BUFSIZE 4096&lt;br /&gt;
&lt;br /&gt;
typedef struct entry {&lt;br /&gt;
        char buf[BUFSIZE];&lt;br /&gt;
        ssize_t count;&lt;br /&gt;
        sem_t lock;&lt;br /&gt;
} entry;&lt;br /&gt;
&lt;br /&gt;
typedef struct shared {&lt;br /&gt;
        pthread_mutex_t cond_mutex;&lt;br /&gt;
        pthread_cond_t  queue_nonempty;&lt;br /&gt;
        pthread_cond_t  queue_nonfull;&lt;br /&gt;
        entry queue[QUEUESIZE];&lt;br /&gt;
        int last_produced;&lt;br /&gt;
        int last_consumed;&lt;br /&gt;
        pid_t prod_pid;&lt;br /&gt;
        pid_t con_pid;&lt;br /&gt;
        int prod_count;&lt;br /&gt;
        int con_count;&lt;br /&gt;
} shared;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void report_error(char *error)&lt;br /&gt;
{&lt;br /&gt;
        fprintf(stderr, &amp;quot;Error: %s\n&amp;quot;, error);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void usage_exit(char *progname)&lt;br /&gt;
{&lt;br /&gt;
        fprintf(stderr,&lt;br /&gt;
                &amp;quot;Usage: %s &amp;lt;source file&amp;gt; &amp;lt;dest file&amp;gt;\n&amp;quot;,&lt;br /&gt;
                progname);&lt;br /&gt;
        exit(-1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void wait_for_producer(shared *s)&lt;br /&gt;
{&lt;br /&gt;
        if (s-&amp;gt;prod_pid != 0) {&lt;br /&gt;
                pthread_mutex_lock(&amp;amp;s-&amp;gt;cond_mutex);&lt;br /&gt;
                pthread_cond_wait(&amp;amp;s-&amp;gt;queue_nonempty, &amp;amp;s-&amp;gt;cond_mutex);&lt;br /&gt;
                pthread_mutex_unlock(&amp;amp;s-&amp;gt;cond_mutex);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void wait_for_consumer(shared *s)&lt;br /&gt;
{&lt;br /&gt;
        if (s-&amp;gt;con_pid != 0) {&lt;br /&gt;
                pthread_mutex_lock(&amp;amp;s-&amp;gt;cond_mutex);&lt;br /&gt;
                pthread_cond_wait(&amp;amp;s-&amp;gt;queue_nonfull, &amp;amp;s-&amp;gt;cond_mutex);&lt;br /&gt;
                pthread_mutex_unlock(&amp;amp;s-&amp;gt;cond_mutex);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int queue_buffer(char *buf, ssize_t count, shared *s)&lt;br /&gt;
{&lt;br /&gt;
        entry *e;&lt;br /&gt;
        int current, retval;&lt;br /&gt;
&lt;br /&gt;
        current = (s-&amp;gt;last_produced + 1) % QUEUESIZE;&lt;br /&gt;
&lt;br /&gt;
        e = &amp;amp;s-&amp;gt;queue[current];&lt;br /&gt;
&lt;br /&gt;
        sem_wait(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
&lt;br /&gt;
        if (e-&amp;gt;count != 0) {&lt;br /&gt;
                sem_post(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
                wait_for_consumer(s);&lt;br /&gt;
                sem_wait(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (e-&amp;gt;count != 0) {&lt;br /&gt;
                fprintf(stderr, &amp;quot;ERROR: No room for producer after waiting!\n&amp;quot;);&lt;br /&gt;
                retval = -1;&lt;br /&gt;
                goto done;&lt;br /&gt;
        } else {&lt;br /&gt;
                memcpy(e-&amp;gt;buf, buf, count);&lt;br /&gt;
                e-&amp;gt;count = count;&lt;br /&gt;
                s-&amp;gt;last_produced = current;&lt;br /&gt;
                s-&amp;gt;prod_count++;&lt;br /&gt;
                /* Notify that queue is nonempty */&lt;br /&gt;
                pthread_cond_signal(&amp;amp;s-&amp;gt;queue_nonempty);&lt;br /&gt;
                retval = 0;&lt;br /&gt;
                goto done;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
 done:&lt;br /&gt;
        sem_post(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
        return retval;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ssize_t get_next_buffer(char *buf, shared *s)&lt;br /&gt;
{&lt;br /&gt;
        entry *e;&lt;br /&gt;
        int current;&lt;br /&gt;
        ssize_t count;&lt;br /&gt;
&lt;br /&gt;
        current = (s-&amp;gt;last_consumed + 1) % QUEUESIZE;&lt;br /&gt;
&lt;br /&gt;
        e = &amp;amp;s-&amp;gt;queue[current];&lt;br /&gt;
&lt;br /&gt;
        sem_wait(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
&lt;br /&gt;
        if (e-&amp;gt;count == 0) {&lt;br /&gt;
                /* producer hasn&amp;#039;t filled in this entry yet */&lt;br /&gt;
                sem_post(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
                wait_for_producer(s);&lt;br /&gt;
                sem_wait(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if (e-&amp;gt;count == 0 &amp;amp;&amp;amp; s-&amp;gt;prod_pid != 0) {&lt;br /&gt;
                fprintf(stderr, &amp;quot;ERROR: Nothing for consumer after waiting!\n&amp;quot;);&lt;br /&gt;
                count = -1;&lt;br /&gt;
                goto done;&lt;br /&gt;
        } else {&lt;br /&gt;
                count = e-&amp;gt;count;&lt;br /&gt;
                memcpy(buf, e-&amp;gt;buf, count);&lt;br /&gt;
                e-&amp;gt;count = 0;&lt;br /&gt;
                s-&amp;gt;last_consumed = current;&lt;br /&gt;
                s-&amp;gt;con_count++;&lt;br /&gt;
                pthread_cond_signal(&amp;amp;s-&amp;gt;queue_nonfull);&lt;br /&gt;
                goto done;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
 done:&lt;br /&gt;
        sem_post(&amp;amp;e-&amp;gt;lock);&lt;br /&gt;
        return count;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void read_file(char *fn, shared *s)&lt;br /&gt;
{&lt;br /&gt;
        char buf[BUFSIZE];&lt;br /&gt;
        int in_fd;&lt;br /&gt;
        ssize_t read_count;&lt;br /&gt;
        int found_data = 0;&lt;br /&gt;
&lt;br /&gt;
        in_fd = open(fn, O_RDONLY);&lt;br /&gt;
&lt;br /&gt;
        if (in_fd == -1) {&lt;br /&gt;
                report_error(&amp;quot;Couldn&amp;#039;t open file for reading\n&amp;quot;);&lt;br /&gt;
                s-&amp;gt;prod_pid = 0;&lt;br /&gt;
                exit(-1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        while ((read_count = read(in_fd, buf, BUFSIZE)) &amp;gt; 0) {&lt;br /&gt;
                found_data = 1;&lt;br /&gt;
                queue_buffer(buf, read_count, s);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        close(in_fd);&lt;br /&gt;
        s-&amp;gt;prod_pid = 0;&lt;br /&gt;
        if (found_data &amp;gt; 0) {&lt;br /&gt;
                printf(&amp;quot;File successfully read and sent.\n&amp;quot;);&lt;br /&gt;
        } else {&lt;br /&gt;
                printf(&amp;quot;No data read from file.\n&amp;quot;);                &lt;br /&gt;
        }&lt;br /&gt;
        exit(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void write_file(char *fn, shared *s)&lt;br /&gt;
{&lt;br /&gt;
        char buf[BUFSIZE];&lt;br /&gt;
        int out_fd;&lt;br /&gt;
        ssize_t read_count, write_count;&lt;br /&gt;
&lt;br /&gt;
        out_fd = creat(fn, 0666);&lt;br /&gt;
        &lt;br /&gt;
        if (out_fd == -1) {&lt;br /&gt;
                report_error(&amp;quot;Couldn&amp;#039;t open file for writing\n&amp;quot;);&lt;br /&gt;
                s-&amp;gt;con_pid = -1;&lt;br /&gt;
                exit(-1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        read_count = 1;&lt;br /&gt;
        while (read_count &amp;gt; 0) {&lt;br /&gt;
                read_count = get_next_buffer(buf, s);&lt;br /&gt;
&lt;br /&gt;
                if (read_count == 0) {&lt;br /&gt;
                        if (s-&amp;gt;prod_pid == 0) {&lt;br /&gt;
                                break;&lt;br /&gt;
                        }&lt;br /&gt;
                } else {&lt;br /&gt;
                        write_count = write(out_fd, buf, read_count);&lt;br /&gt;
&lt;br /&gt;
                        if (write_count != read_count) {&lt;br /&gt;
                                report_error(&amp;quot;Problem writing file to disk.&amp;quot;);&lt;br /&gt;
                                s-&amp;gt;con_pid = 0;&lt;br /&gt;
                                exit(-1);&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        s-&amp;gt;con_pid = 0;&lt;br /&gt;
        close(out_fd);&lt;br /&gt;
        printf(&amp;quot;File successfully received and copied.\n&amp;quot;);&lt;br /&gt;
        exit(0);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void init_shared(shared *s)&lt;br /&gt;
{&lt;br /&gt;
        int i;&lt;br /&gt;
&lt;br /&gt;
        pthread_mutexattr_t mattr = {};&lt;br /&gt;
        pthread_mutexattr_setpshared(&amp;amp;mattr, 1);&lt;br /&gt;
        pthread_mutex_init(&amp;amp;s-&amp;gt;cond_mutex, &amp;amp;mattr);&lt;br /&gt;
&lt;br /&gt;
        pthread_condattr_t cattr = {};&lt;br /&gt;
        pthread_condattr_setpshared(&amp;amp;cattr, 1);&lt;br /&gt;
        pthread_cond_init(&amp;amp;s-&amp;gt;queue_nonempty, &amp;amp;cattr);&lt;br /&gt;
        pthread_cond_init(&amp;amp;s-&amp;gt;queue_nonfull, &amp;amp;cattr);&lt;br /&gt;
&lt;br /&gt;
        s-&amp;gt;last_consumed = -1;&lt;br /&gt;
        s-&amp;gt;last_produced = -1;&lt;br /&gt;
&lt;br /&gt;
        s-&amp;gt;prod_pid = -1;&lt;br /&gt;
        s-&amp;gt;con_pid  = -1;&lt;br /&gt;
&lt;br /&gt;
        s-&amp;gt;prod_count = 0;&lt;br /&gt;
        s-&amp;gt;con_count  = 0;&lt;br /&gt;
&lt;br /&gt;
        for (i=0; i&amp;lt;QUEUESIZE; i++) {&lt;br /&gt;
                s-&amp;gt;queue[i].count = 0;&lt;br /&gt;
                sem_init(&amp;amp;s-&amp;gt;queue[i].lock, 1, 1);&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
        int pid;&lt;br /&gt;
        shared *s;&lt;br /&gt;
        char *source_fn, *dest_fn;&lt;br /&gt;
&lt;br /&gt;
        if (argc &amp;lt; 3) {&lt;br /&gt;
                if (argc &amp;lt; 1) {&lt;br /&gt;
                        report_error(&amp;quot;no command line&amp;quot;);&lt;br /&gt;
                        usage_exit(argv[0]);&lt;br /&gt;
                } else {&lt;br /&gt;
                        report_error(&amp;quot;Not enough arguments&amp;quot;);&lt;br /&gt;
                        usage_exit(argv[0]);&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        source_fn = argv[1];&lt;br /&gt;
        dest_fn = argv[2];&lt;br /&gt;
&lt;br /&gt;
        s = (shared *) mmap(NULL, sizeof(shared),&lt;br /&gt;
                             PROT_READ|PROT_WRITE,&lt;br /&gt;
                             MAP_SHARED|MAP_ANONYMOUS, -1, 0);&lt;br /&gt;
&lt;br /&gt;
        if (s == MAP_FAILED)&lt;br /&gt;
        {&lt;br /&gt;
                fprintf(stderr, &amp;quot;Error: Unable to mmap: %s\n&amp;quot;, strerror(errno));&lt;br /&gt;
                exit(-1);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        init_shared(s);&lt;br /&gt;
&lt;br /&gt;
        pid = fork();&lt;br /&gt;
&lt;br /&gt;
        if (pid == 0) {&lt;br /&gt;
                s-&amp;gt;prod_pid = getpid();&lt;br /&gt;
                read_file(source_fn, s);&lt;br /&gt;
        } else {&lt;br /&gt;
                s-&amp;gt;con_pid = getpid();&lt;br /&gt;
                write_file(dest_fn, s);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return -1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>