<?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=COMP3000_Operating_Systems_F23%3A_Tutorial_6</id>
	<title>COMP3000 Operating Systems F23: Tutorial 6 - 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=COMP3000_Operating_Systems_F23%3A_Tutorial_6"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;action=history"/>
	<updated>2026-06-02T19:43:53Z</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=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24555&amp;oldid=prev</id>
		<title>Abdou: /* C: Producer/Consumer with Shared Memory */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24555&amp;oldid=prev"/>
		<updated>2023-10-25T01:09:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;C: Producer/Consumer with Shared Memory&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 01:09, 25 October 2023&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-l29&quot;&gt;Line 29:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 29:&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;==C: Producer/Consumer with Shared Memory==&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;==C: Producer/Consumer with Shared Memory==&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 style=&amp;quot;list-style-type:decimal&amp;quot;&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 style=&amp;quot;list-style-type:decimal&amp;quot;&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; Examine the source code of &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;. Explain the following:&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; Examine the source code of &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;. Explain the following:&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 style=&amp;quot;list-style-type:lower-alpha&amp;quot;&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 style=&amp;quot;list-style-type:lower-alpha&amp;quot;&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; What are a few ways that &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; is different from &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;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; What are a few ways that &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; is different from &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;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; 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; What does the call to &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;mmap()&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; on line 347 do (compared to our previous uses of &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;mmap()&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;)? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; did you figure this out? &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; What does the call to &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;mmap()&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; on line 347 do (compared to our previous uses of &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;mmap()&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;)? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; did you figure this out? &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; How does the producer notify the consumer that the queue is no longer empty? &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; How does the producer notify the consumer that the queue is no longer empty? &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; How does the consumer notify the producer that the queue is no longer full? &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; How does the consumer notify the producer that the queue is no longer full? &amp;lt;/li&amp;gt;&lt;/div&gt;&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-l39&quot;&gt;Line 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 39:&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; What arguments can you provide to make the producer wait for the consumer? Hint: Check the size of the queue. &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; What arguments can you provide to make the producer wait for the consumer? Hint: Check the size of the queue. &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; What arguments can you provide to make the consumer wait for the producer? (You can disregard the wait at the very beginning as the queue is initially empty) &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; What arguments can you provide to make the consumer wait for the producer? (You can disregard the wait at the very beginning as the queue is initially empty) &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; Another student tells you that the difference between processes and threads is that processes never share memory, while threads do. Is this statement correct or incorrect? How can the behavior of &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; help justify your answer? &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; Another student tells you that the difference between processes and threads is that processes never share memory, while threads do. Is this statement correct or incorrect? How can the behavior of &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; help justify your answer? &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; Change the calls to &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;pthread_mutexattr_setpshared()&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; and &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;pthread_condattr_setpshared()&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; (lines 293 and 298) to take 0 instead of 1. How does the behavior or &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; change? Does anything break? &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; Change the calls to &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;pthread_mutexattr_setpshared()&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; and &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;pthread_condattr_setpshared()&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; (lines 293 and 298) to take 0 instead of 1. How does the behavior or &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; change? Does anything break? &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;/table&gt;</summary>
		<author><name>Abdou</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24554&amp;oldid=prev</id>
		<title>Abdou: /* B: Producer/Consumer with Pipes */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24554&amp;oldid=prev"/>
		<updated>2023-10-25T01:08:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;B: Producer/Consumer with Pipes&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 01:08, 25 October 2023&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-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&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;==B: Producer/Consumer with Pipes==&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;==B: Producer/Consumer with Pipes==&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 style=&amp;quot;list-style-type:decimal&amp;quot;&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 style=&amp;quot;list-style-type:decimal&amp;quot;&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; Examine the source code of &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;. Pay attention to the call to &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;pipe(pipefd)&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; on line 192 and make the connection with what has been discussed in the lecture (also look at the man page for &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;pipe(2)&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;). Explain the following:&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; Examine the source code of &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;. Pay attention to the call to &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;pipe(pipefd)&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; on line 192 and make the connection with what has been discussed in the lecture (also look at the man page for &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;pipe(2)&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;). Explain the following:&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 style=&amp;quot;list-style-type:lower-alpha&amp;quot;&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 style=&amp;quot;list-style-type:lower-alpha&amp;quot;&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; How does the consumer receive words to consume? &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; How does the consumer receive words to consume? &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; How does the producer generate and send words to the consumer? &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; How does the producer generate and send words to the consumer? &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; Why is the call to &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;srandom(time(NULL))&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; on line 169 necessary? &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; Why is the call to &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;srandom(time(NULL))&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; on line 169 necessary? &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;div&gt;&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;&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; Replace the call to &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;srandom(time(NULL))&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; on line 169 with &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;srandom(42)&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;. What differences do you notice in &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;&#039;s behavior? &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; Replace the call to &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;srandom(time(NULL))&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; on line 169 with &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;srandom(42)&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;. What differences do you notice in &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;&#039;s behavior? &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>Abdou</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24553&amp;oldid=prev</id>
		<title>Abdou: /* A: Getting Started */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24553&amp;oldid=prev"/>
		<updated>2023-10-25T01:07:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;A: Getting Started&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 01:07, 25 October 2023&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-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&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;==A: Getting Started==&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;==A: Getting Started==&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;Download [https://people.scs.carleton.ca/~&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;lianyingzhao&lt;/del&gt;/comp3000/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;w23&lt;/del&gt;/tut6/3000pc.zip 3000pc.zip], unpack, and run &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;make&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; to compile &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; and &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&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;Download [https://people.scs.carleton.ca/~&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;abdou&lt;/ins&gt;/comp3000/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;f23&lt;/ins&gt;/tut6/3000pc.zip 3000pc.zip], unpack, and run &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;make&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; to compile &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-fifo&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; and &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;3000pc-rendezvous&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&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;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;Try to take this opportunity to read and understand the two programs line by line.&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;Try to take this opportunity to read and understand the two programs line by line.&lt;/div&gt;&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-l12&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&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;# Run both programs with the same arguments of your choice. Do this a few times with different arguments. Do they behave the same way? Do you notice &amp;lt;u&amp;gt;any differences&amp;lt;/u&amp;gt;?  (again, no “correct” answers but just play with them and document your observations)&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;# Run both programs with the same arguments of your choice. Do this a few times with different arguments. Do they behave the same way? Do you notice &amp;lt;u&amp;gt;any differences&amp;lt;/u&amp;gt;?  (again, no “correct” answers but just play with them and document your observations)&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;# Repeat the above experiment, this time running each program under &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;strace&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; (with the &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;-f&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; flag to trace children too). Do you notice any difference in the system calls each program makes? Remember to ignore the lines before &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;main()&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; that might be distracting, e.g., start looking around and after the &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;clone()&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt; system call.&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;# Repeat the above experiment, this time running each program under &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;strace&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; (with the &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;-f&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; flag to trace children too). Do you notice any difference in the system calls each program makes? Remember to ignore the lines before &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;main()&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; that might be distracting, e.g., start looking around and after the &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;clone()&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt; system call.&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;# You can see there is &quot;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;#define QUEUESIZE 32&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tt&lt;/del&gt;&amp;gt;&quot; in both programs. Are they actually used? &amp;lt;u&amp;gt;Why (not)&amp;lt;/u&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;# You can see there is &quot;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;#define QUEUESIZE 32&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/ins&gt;&amp;gt;&quot; in both programs. Are they actually used? &amp;lt;u&amp;gt;Why (not)&amp;lt;/u&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;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;==B: Producer/Consumer with Pipes==&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;==B: Producer/Consumer with Pipes==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Abdou</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24552&amp;oldid=prev</id>
		<title>Abdou: /* General Instructions (same for all tutorials) */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24552&amp;oldid=prev"/>
		<updated>2023-10-25T01:06:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;General Instructions (same for all tutorials)&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 01:06, 25 October 2023&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;In this tutorial you will be learning about two implementations of the [https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem producer-consumer problem], a classic example of a concurrency problem. The [http://pages.cs.wisc.edu/~remzi/OSTEP/ class textbook] covers concurrency in great detail in Chapters 25-34, and the producer-consumer problem is covered in [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf Chapter 30 (Condition Variables)] and [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-sema.pdf Chapter 31 (Semaphores)]. While you can look at this part of the textbook, note that we will not be covering this material in the same level of detail, as should be clear from this tutorial.&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;In this tutorial you will be learning about two implementations of the [https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem producer-consumer problem], a classic example of a concurrency problem. The [http://pages.cs.wisc.edu/~remzi/OSTEP/ class textbook] covers concurrency in great detail in Chapters 25-34, and the producer-consumer problem is covered in [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf Chapter 30 (Condition Variables)] and [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-sema.pdf Chapter 31 (Semaphores)]. While you can look at this part of the textbook, note that we will not be covering this material in the same level of detail, as should be clear from this tutorial.&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;&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; 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;==General Instructions (same for all tutorials)==&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; 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;&amp;lt;div class=&quot;mw-collapsible mw-collapsed&quot;&amp;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; 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;Click on Expand to view.&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;&amp;lt;div class=&quot;mw-collapsible-content&quot;&amp;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; 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;Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;), but you should still turn in your work. Submit your answers on Brightspace as a single text file named &quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section.&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; 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;The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&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; 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;You should also check in with your assigned TA (in person or by responding to a poll if online). Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &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; 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;You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&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; 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;Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&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;&amp;lt;/div&amp;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; 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;&amp;lt;/div&amp;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;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;==A: Getting Started==&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;==A: Getting Started==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Abdou</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24551&amp;oldid=prev</id>
		<title>Abdou: Created page with &quot;In this tutorial you will be learning about two implementations of the [https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem producer-consumer problem], a classic example of a concurrency problem. The [http://pages.cs.wisc.edu/~remzi/OSTEP/ class textbook] covers concurrency in great detail in Chapters 25-34, and the producer-consumer problem is covered in [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf Chapter 30 (Condition Variables)] and [http://pages...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_F23:_Tutorial_6&amp;diff=24551&amp;oldid=prev"/>
		<updated>2023-10-25T01:05:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;In this tutorial you will be learning about two implementations of the [https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem producer-consumer problem], a classic example of a concurrency problem. The [http://pages.cs.wisc.edu/~remzi/OSTEP/ class textbook] covers concurrency in great detail in Chapters 25-34, and the producer-consumer problem is covered in [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf Chapter 30 (Condition Variables)] and [http://pages...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In this tutorial you will be learning about two implementations of the [https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem producer-consumer problem], a classic example of a concurrency problem. The [http://pages.cs.wisc.edu/~remzi/OSTEP/ class textbook] covers concurrency in great detail in Chapters 25-34, and the producer-consumer problem is covered in [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-cv.pdf Chapter 30 (Condition Variables)] and [http://pages.cs.wisc.edu/~remzi/OSTEP/threads-sema.pdf Chapter 31 (Semaphores)]. While you can look at this part of the textbook, note that we will not be covering this material in the same level of detail, as should be clear from this tutorial.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&amp;#039;&amp;#039;&amp;#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&amp;#039;&amp;#039;&amp;#039;), but you should still turn in your work. Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &amp;#039;&amp;#039;&amp;#039;Tasks/Questions&amp;#039;&amp;#039;&amp;#039; section.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA (in person or by responding to a poll if online). Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==A: Getting Started==&lt;br /&gt;
Download [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w23/tut6/3000pc.zip 3000pc.zip], unpack, and run &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; to compile &amp;lt;tt&amp;gt;3000pc-fifo&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;3000pc-rendezvous&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Try to take this opportunity to read and understand the two programs line by line.&lt;br /&gt;
&lt;br /&gt;
:: Note that these programs take 3 arguments each:&lt;br /&gt;
::* The number of events to process&lt;br /&gt;
::* The number of events to produce before the producer sleeps for 1 second&lt;br /&gt;
::* The number of events to consume before the consumer sleeps for 1 second&lt;br /&gt;
&lt;br /&gt;
# Run both programs with the same arguments of your choice. Do this a few times with different arguments. Do they behave the same way? Do you notice &amp;lt;u&amp;gt;any differences&amp;lt;/u&amp;gt;?  (again, no “correct” answers but just play with them and document your observations)&lt;br /&gt;
# Repeat the above experiment, this time running each program under &amp;lt;tt&amp;gt;strace&amp;lt;/tt&amp;gt; (with the &amp;lt;tt&amp;gt;-f&amp;lt;/tt&amp;gt; flag to trace children too). Do you notice any difference in the system calls each program makes? Remember to ignore the lines before &amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt; that might be distracting, e.g., start looking around and after the &amp;lt;tt&amp;gt;clone()&amp;lt;/tt&amp;gt; system call.&lt;br /&gt;
# You can see there is &amp;quot;&amp;lt;tt&amp;gt;#define QUEUESIZE 32&amp;lt;/tt&amp;gt;&amp;quot; in both programs. Are they actually used? &amp;lt;u&amp;gt;Why (not)&amp;lt;/u&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
==B: Producer/Consumer with Pipes==&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:decimal&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Examine the source code of &amp;lt;tt&amp;gt;3000pc-fifo&amp;lt;/tt&amp;gt;. Pay attention to the call to &amp;lt;tt&amp;gt;pipe(pipefd)&amp;lt;/tt&amp;gt; on line 192 and make the connection with what has been discussed in the lecture (also look at the man page for &amp;lt;tt&amp;gt;pipe(2)&amp;lt;/tt&amp;gt;). Explain the following:&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; How does the consumer receive words to consume? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; How does the producer generate and send words to the consumer? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Why is the call to &amp;lt;tt&amp;gt;srandom(time(NULL))&amp;lt;/tt&amp;gt; on line 169 necessary? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Replace the call to &amp;lt;tt&amp;gt;srandom(time(NULL))&amp;lt;/tt&amp;gt; on line 169 with &amp;lt;tt&amp;gt;srandom(42)&amp;lt;/tt&amp;gt;. What differences do you notice in &amp;lt;tt&amp;gt;3000pc-fifo&amp;lt;/tt&amp;gt;&amp;#039;s behavior? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==C: Producer/Consumer with Shared Memory==&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:decimal&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Examine the source code of &amp;lt;tt&amp;gt;3000pc-rendezvous&amp;lt;/tt&amp;gt;. Explain the following:&lt;br /&gt;
&amp;lt;ol style=&amp;quot;list-style-type:lower-alpha&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; What are a few ways that &amp;lt;tt&amp;gt;3000pc-rendezvous&amp;lt;/tt&amp;gt; is different from &amp;lt;tt&amp;gt;3000pc-fifo&amp;lt;/tt&amp;gt;? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; What does the call to &amp;lt;tt&amp;gt;mmap()&amp;lt;/tt&amp;gt; on line 347 do (compared to our previous uses of &amp;lt;tt&amp;gt;mmap()&amp;lt;/tt&amp;gt;)? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; did you figure this out? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; How does the producer notify the consumer that the queue is no longer empty? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; How does the consumer notify the producer that the queue is no longer full? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; What arguments can you provide to make the producer wait for the consumer? Hint: Check the size of the queue. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; What arguments can you provide to make the consumer wait for the producer? (You can disregard the wait at the very beginning as the queue is initially empty) &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Another student tells you that the difference between processes and threads is that processes never share memory, while threads do. Is this statement correct or incorrect? How can the behavior of &amp;lt;tt&amp;gt;3000pc-rendezvous&amp;lt;/tt&amp;gt; help justify your answer? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Change the calls to &amp;lt;tt&amp;gt;pthread_mutexattr_setpshared()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pthread_condattr_setpshared()&amp;lt;/tt&amp;gt; (lines 293 and 298) to take 0 instead of 1. How does the behavior or &amp;lt;tt&amp;gt;3000pc-rendezvous&amp;lt;/tt&amp;gt; change? Does anything break? &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Abdou</name></author>
	</entry>
</feed>