<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Praman</id>
	<title>Soma-notes - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Praman"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php/Special:Contributions/Praman"/>
	<updated>2026-04-22T11:21:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5574</id>
		<title>Operating Systems (Fall 2010)</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5574"/>
		<updated>2010-11-25T13:24:51Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Lectures and Deadlines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the main page for the Fall 2010 run of Carleton University&#039;s COMP 3000, Operating Systems.  The instructor for this course is [http://people.scs.carleton.ca/~soma Anil Somayaji]&lt;br /&gt;
&lt;br /&gt;
==Course Outline==&lt;br /&gt;
&lt;br /&gt;
The course outline for this course can be found [http://www.scs.carleton.ca/courses/course_outline.php?Number=COMP%203000&amp;amp;Term=Fall&amp;amp;Year=2010 here]&lt;br /&gt;
&lt;br /&gt;
==Class Help==&lt;br /&gt;
&lt;br /&gt;
The best way to get general help for this class is to email or IM &amp;quot;2010comp3000 at gmail dot com&amp;quot;.  TAs and the instructor will be monitoring this account.  For grade-specific questions, however, please email the TAs and/or the instructor directly using your Connect account.&lt;br /&gt;
&lt;br /&gt;
==Group assignments==&lt;br /&gt;
&lt;br /&gt;
Randomized group assignments for the essays are listed in WebCT.&lt;br /&gt;
&lt;br /&gt;
==Lectures and Deadlines==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 100%;&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Date&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Due/In Class&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Topics&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Readings&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Sept. 9th&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Class Outline&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 14th &amp;amp; 16th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;OS Overview&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 1&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 19th &amp;amp; 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 1 2010|Lab 1]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 28th &amp;amp; 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 2 2010|Lab 2]] [[COMP 3000 Lab 2 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 5th &amp;amp; 7th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 3 2010|Lab 3]] [[COMP 3000 Lab 3 2010 Soln|(Solutions)]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 1 2010|Assignment 1]] (Oct. 7th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 12th &amp;amp; 14th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 1 2010 Questions|Essay 1]] (Oct. 14th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 19th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm review 2010|Midterm review]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm exam 2010|Midterm exam]]&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;SA 515 and SA 624&amp;lt;/b&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 26th &amp;amp; 28th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Input/Output&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 2nd &amp;amp; 4th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 4 2010|Lab 4]] [[COMP_3000_Lab_4_2010#Hints|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 9th &amp;amp; 11th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 5 2010|Lab 5]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 16 &amp;amp; 18th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 6 2010|Lab 6]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 2|Assignment 2]] (Nov. 18th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Virtual Machines&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 23 &amp;amp; 25th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Distributed OSs&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Security&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 9&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 2nd&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 2 2010|Essay 2]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;The Future of Operating Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 9th, 19:00&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Final Exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5573</id>
		<title>Operating Systems (Fall 2010)</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5573"/>
		<updated>2010-11-25T13:16:54Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Lectures and Deadlines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the main page for the Fall 2010 run of Carleton University&#039;s COMP 3000, Operating Systems.  The instructor for this course is [http://people.scs.carleton.ca/~soma Anil Somayaji]&lt;br /&gt;
&lt;br /&gt;
==Course Outline==&lt;br /&gt;
&lt;br /&gt;
The course outline for this course can be found [http://www.scs.carleton.ca/courses/course_outline.php?Number=COMP%203000&amp;amp;Term=Fall&amp;amp;Year=2010 here]&lt;br /&gt;
&lt;br /&gt;
==Class Help==&lt;br /&gt;
&lt;br /&gt;
The best way to get general help for this class is to email or IM &amp;quot;2010comp3000 at gmail dot com&amp;quot;.  TAs and the instructor will be monitoring this account.  For grade-specific questions, however, please email the TAs and/or the instructor directly using your Connect account.&lt;br /&gt;
&lt;br /&gt;
==Group assignments==&lt;br /&gt;
&lt;br /&gt;
Randomized group assignments for the essays are listed in WebCT.&lt;br /&gt;
&lt;br /&gt;
==Lectures and Deadlines==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 100%;&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Date&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Due/In Class&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Topics&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Readings&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Sept. 9th&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Class Outline&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 14th &amp;amp; 16th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;OS Overview&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 1&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 19th &amp;amp; 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 1 2010|Lab 1]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 28th &amp;amp; 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 2 2010|Lab 2]] [[COMP 3000 Lab 2 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 5th &amp;amp; 7th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 3 2010|Lab 3]] [[COMP 3000 Lab 3 2010 Soln|(Solutions)]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 1 2010|Assignment 1]] (Oct. 7th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 12th &amp;amp; 14th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 1 2010 Questions|Essay 1]] (Oct. 14th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 19th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm review 2010|Midterm review]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm exam 2010|Midterm exam]]&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;SA 515 and SA 624&amp;lt;/b&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 26th &amp;amp; 28th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Input/Output&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 2nd &amp;amp; 4th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 4 2010|Lab 4]] [[COMP 3000 Lab 4 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 9th &amp;amp; 11th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 5 2010|Lab 5]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 16 &amp;amp; 18th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 6 2010|Lab 6]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 2|Assignment 2]] (Nov. 18th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Virtual Machines&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 23 &amp;amp; 25th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Distributed OSs&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Security&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 9&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 2nd&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 2 2010|Essay 2]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;The Future of Operating Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 9th, 19:00&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Final Exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5572</id>
		<title>Operating Systems (Fall 2010)</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5572"/>
		<updated>2010-11-25T13:15:21Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Lectures and Deadlines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the main page for the Fall 2010 run of Carleton University&#039;s COMP 3000, Operating Systems.  The instructor for this course is [http://people.scs.carleton.ca/~soma Anil Somayaji]&lt;br /&gt;
&lt;br /&gt;
==Course Outline==&lt;br /&gt;
&lt;br /&gt;
The course outline for this course can be found [http://www.scs.carleton.ca/courses/course_outline.php?Number=COMP%203000&amp;amp;Term=Fall&amp;amp;Year=2010 here]&lt;br /&gt;
&lt;br /&gt;
==Class Help==&lt;br /&gt;
&lt;br /&gt;
The best way to get general help for this class is to email or IM &amp;quot;2010comp3000 at gmail dot com&amp;quot;.  TAs and the instructor will be monitoring this account.  For grade-specific questions, however, please email the TAs and/or the instructor directly using your Connect account.&lt;br /&gt;
&lt;br /&gt;
==Group assignments==&lt;br /&gt;
&lt;br /&gt;
Randomized group assignments for the essays are listed in WebCT.&lt;br /&gt;
&lt;br /&gt;
==Lectures and Deadlines==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 100%;&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Date&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Due/In Class&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Topics&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Readings&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Sept. 9th&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Class Outline&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 14th &amp;amp; 16th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;OS Overview&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 1&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 19th &amp;amp; 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 1 2010|Lab 1]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 28th &amp;amp; 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 2 2010|Lab 2]] [[COMP 3000 Lab 2 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 5th &amp;amp; 7th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 3 2010|Lab 3]] [[COMP 3000 Lab 3 2010 Soln|(Solutions)]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 1 2010|Assignment 1]] (Oct. 7th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 12th &amp;amp; 14th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 1 2010 Questions|Essay 1]] (Oct. 14th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 19th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm review 2010|Midterm review]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm exam 2010|Midterm exam]]&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;SA 515 and SA 624&amp;lt;/b&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 26th &amp;amp; 28th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Input/Output&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 2nd &amp;amp; 4th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 4 2010|Lab 4]][[COMP 3000 Lab 4 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 9th &amp;amp; 11th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 5 2010|Lab 5]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 16 &amp;amp; 18th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 6 2010|Lab 6]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 2|Assignment 2]] (Nov. 18th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Virtual Machines&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 23 &amp;amp; 25th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Distributed OSs&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Security&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 9&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 2nd&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 2 2010|Essay 2]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;The Future of Operating Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 9th, 19:00&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Final Exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5571</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5571"/>
		<updated>2010-11-25T13:13:55Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: When the parent closes the pipe, the child is sent a SIGPIPE signal when it tries to write to the pipe and the default action for a SIGPIPE signal is to terminate the program, hence the printf never runs. The program had another bug in that there was a while(1) loop which would have run forever had the process not been killed by the SIGPIPE signal. The while(1) loop, however, does not explain why the child died at all and the fact that the child exited at all should have been an obvious clue as to what was happening.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The lower 9 bits of the shmflg value.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A:&amp;lt;br /&amp;gt;• Read,Write and Execute for the Owner&amp;lt;br /&amp;gt;• Read andWrite for the Group&amp;lt;br /&amp;gt;• No permissions for everyone else&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: 0600 Any additional bits set represent a potential security issue in that additional processes not owned by the user may be able to interfere with the shared memory. The execute permission is not required in this question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: include/linux/sched.h&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Internal process name&lt;br /&gt;
!pid&lt;br /&gt;
|-&lt;br /&gt;
|State&lt;br /&gt;
|state&lt;br /&gt;
|-&lt;br /&gt;
|Owner&lt;br /&gt;
|uid, euid, suid, fsuid, gid, egid, sgid, fsgid&lt;br /&gt;
|-&lt;br /&gt;
|Execution Statistics &lt;br /&gt;
|sleep avg, last ran, utime, stime, nvcsw, nivcsw&lt;br /&gt;
|-&lt;br /&gt;
|Thread &lt;br /&gt;
|thread info&lt;br /&gt;
|-&lt;br /&gt;
|Related Processes &lt;br /&gt;
|parent, real parent, group leader&lt;br /&gt;
|-&lt;br /&gt;
|Child Processes &lt;br /&gt;
|children&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Here are all the flags you could have listed:&amp;lt;br /&amp;gt;• CLONE PARENT - Useful when one child wants to create another process but have it be a sibling instead of a child. In this way, a complex application can have a parent which takes care of administration and any of the children would be able to create additional processes that are also taken care of by the parent. If this flag did not exist, the child would have to ask the parent to create the new process.&amp;lt;br /&amp;gt;• CLONE FS - chroot is often useful when you want to have processes only have access to a part of the file system. It restricts within the kernel what directories the program can access. If this flag is set, a server could be started with access to the entire file system and then after initialization access could be restricted to just those directories needed by the server during operation. As an example, a web server could be started and after it is running the parent could perform a chroot and the child would then be restricted to only the part of the file system containing files which should be displayed by the web server (there are security problems associated with open file handles when doing a chroot, but we do not discuss them here).&amp;lt;br /&amp;gt;• CLONE FILES - If the child was to do work on a file handle, the parent (or dispatcher) could open files and then tell the child to operate on a specific file handle. Since file handles are simply integers, passing a file handle back and forth between processes only works if this option is enabled.&amp;lt;br /&amp;gt;• CLONE NEWNS - Useful if you only wanted a new mounted drive to be accessible to certain processes. You could mount the drive in a new namespace and then all processes not in that name-space would not be able to access the mounted drive (since the drive would not be mounted in their name-space). It gives a way of protecting data on the drive when access permissions are not sufficient.&amp;lt;br /&amp;gt;• CLONE SIGHAND - Allows a parent to catch signals that should be destined for the child process. This is especially useful when creating threads, where only one signal handler should be present for the group of threads (you don’t want different things happening depending on which thread generated the signal).&amp;lt;br /&amp;gt;• CLONE PTRACE - Allows debugging of children created by a parent process which is also being debugged.&amp;lt;br /&amp;gt;• CLONE VFORK - If a process wants to spawn off another program, it can use this option to block until the child has actually executed the new process. This prevents possible race conditions where the parent spawns off the child and then runs before the child has an opportunity to execute the replacement program.&amp;lt;br /&amp;gt;• CLONE VM - Sharing memory space is one of the basic desired traits when creating threads. It allows two threads to operate on the same data (with appropriate locking mechanisms of course).&amp;lt;br /&amp;gt;• CLONE PID - As it says, this is a hack. It allows creating a new process with the same PID so that when the parent exits, all other processes which refer to the process based on it’s pid will still be talking to the correct process.&amp;lt;br /&amp;gt;• CLONE THREAD - This results in a thread which shares the PID of the process. It is useful in conjunction with the CLONE VM function to create multiple threads which all share the same process ID and memory space.&amp;lt;br /&amp;gt;• CLONE SETTLS - Used by threading libraries. The description of this in the man page is not very clear.&amp;lt;br /&amp;gt;• CLONE PARENT SETTID- Used by threading libraries, itmakes the kernel write information on the thread to a specific location in memory, which is useful for keeping track of the threads.&amp;lt;br /&amp;gt;• CLONE CHILD SETTID - Used by threading libraries, it makes the kernel write information on the thread to a specific location in memory, which is useful for keeping track of the threads.&amp;lt;br /&amp;gt;• CLONE CHILD CLEARTID - Used by threading libraries, it forces the kernel to write information to the thread data structure in the parent when the child exits.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The key thing to note is that both sys clone() and sys fork() are implemented in terms of the same function, do fork(). To only expose one of these to userspace, you’d need to expose clone and implement the others it terms of it, because it is the system call that allows one to specify all of the arguments to do fork().&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* from arch/i386/kernel/process.c */&amp;lt;br /&amp;gt;&lt;br /&gt;
asmlinkage int sys_fork(struct pt_regs regs)&amp;lt;br /&amp;gt;&lt;br /&gt;
{&amp;lt;br /&amp;gt;&lt;br /&gt;
return do_fork(SIGCHLD, regs.esp, &amp;amp;regs, 0, NULL, NULL);&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
asmlinkage int sys_clone(struct pt_regs regs)&amp;lt;br /&amp;gt;&lt;br /&gt;
{&amp;lt;br /&amp;gt;&lt;br /&gt;
unsigned long clone_flags;&amp;lt;br /&amp;gt;&lt;br /&gt;
unsigned long newsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
int __user *parent_tidptr, *child_tidptr;&amp;lt;br /&amp;gt;&lt;br /&gt;
clone_flags = regs.ebx;&amp;lt;br /&amp;gt;&lt;br /&gt;
newsp = regs.ecx;&amp;lt;br /&amp;gt;&lt;br /&gt;
parent_tidptr = (int __user *)regs.edx;&amp;lt;br /&amp;gt;&lt;br /&gt;
child_tidptr = (int __user *)regs.edi;&amp;lt;br /&amp;gt;&lt;br /&gt;
if (!newsp)&amp;lt;br /&amp;gt;&lt;br /&gt;
newsp = regs.esp;&amp;lt;br /&amp;gt;&lt;br /&gt;
return do_fork(clone_flags, newsp, &amp;amp;regs, 0,&amp;lt;br /&amp;gt;&lt;br /&gt;
parent_tidptr, child_tidptr);&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* This is trivial, and on the face of it looks like it could equally well be done in user mode. Not so, for quite unobvious reasons - register pressure.In user mode vfork() cannot have a stack frame, and if done by calling the &amp;quot;clone()&amp;quot; system call directly, you do not have enough call-clobbered registers to hold all the information you need.*/&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
asmlinkage int sys_vfork(struct pt_regs regs)&amp;lt;br /&amp;gt;&lt;br /&gt;
{&amp;lt;br /&amp;gt;&lt;br /&gt;
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.esp,&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;regs, 0, NULL, NULL);&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Linux kernel has no knowledge that file descriptors 0, 1, and 2 are special— that is simply a convention of userspace. If you examine the code of sys open(), do sys open(), and get unused fd() in fs/open.c, you’ll see that there is no code referring to these file descriptors explicitly.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: There are a few ways of answering this:&amp;lt;br /&amp;gt;• Count the number of signals received of a specific type and that is the value being passed back.&amp;lt;br /&amp;gt;• As an improvement, use two signals, one which increments the placeholder and the other which flips (or increments) the value pointed to by the place- holder. This can be done for any base (but base 2 is most convenient).&amp;lt;br /&amp;gt;• As an even better solution, use two signals, one represents a 0 bit being passed and the other represents a 1 bit. So, a sequence of SIGUSR1, SIGUSR1, SIGUSR2, SIGUSR1 may be translated as 1101.&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&amp;lt;br /&amp;gt;A: Changes to wait-signal.c:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--- ../src/wait-signal.c &amp;lt;br /&amp;gt;&lt;br /&gt;
+++ wait-signal-pipe.c &amp;lt;br /&amp;gt;&lt;br /&gt;
@@ -78,6 +78,13 @@&amp;lt;br /&amp;gt;&lt;br /&gt;
int matrixA[MATRIX_SIZE * MATRIX_SIZE];&amp;lt;br /&amp;gt;&lt;br /&gt;
int matrixB[MATRIX_SIZE * MATRIX_SIZE];&amp;lt;br /&amp;gt;&lt;br /&gt;
int matrixC[MATRIX_SIZE * MATRIX_SIZE];&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int mypipe[2];&amp;lt;br /&amp;gt;&lt;br /&gt;
+&amp;lt;br /&amp;gt;&lt;br /&gt;
+ struct {&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int x;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int y;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int value;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ } retData;&amp;lt;br /&amp;gt;&lt;br /&gt;
/* Initialize the matricies. */&amp;lt;br /&amp;gt;&lt;br /&gt;
init_matrix( matrixA, 0 );&amp;lt;br /&amp;gt;&lt;br /&gt;
@@ -95,13 +102,21 @@&amp;lt;br /&amp;gt;&lt;br /&gt;
printf( &amp;quot;Matrix B:\n&amp;quot; );&amp;lt;br /&amp;gt;&lt;br /&gt;
print_matrix( matrixB );&amp;lt;br /&amp;gt;&lt;br /&gt;
+ pipe( mypipe );&amp;lt;br /&amp;gt;&lt;br /&gt;
+&amp;lt;br /&amp;gt;&lt;br /&gt;
/* Start those children running... */&amp;lt;br /&amp;gt;&lt;br /&gt;
for( y = 0; y &amp;lt; MATRIX_SIZE; y++ ) {&amp;lt;br /&amp;gt;&lt;br /&gt;
for( x = 0; x &amp;lt; MATRIX_SIZE; x++ ) {&amp;lt;br /&amp;gt;&lt;br /&gt;
pid = fork();&amp;lt;br /&amp;gt;&lt;br /&gt;
if( pid == 0 ) {&amp;lt;br /&amp;gt;&lt;br /&gt;
/* We are the child. */&amp;lt;br /&amp;gt;&lt;br /&gt;
+ close( mypipe[0] );&amp;lt;br /&amp;gt;&lt;br /&gt;
+&amp;lt;br /&amp;gt;&lt;br /&gt;
int value = calc_elem( matrixA, matrixB, x, y );&amp;lt;br /&amp;gt;&lt;br /&gt;
+ retData.x = x;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ retData.y = y;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ retData.value = value;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ write( mypipe[1], &amp;amp;retData, sizeof(retData) );&amp;lt;br /&amp;gt;&lt;br /&gt;
return value;&amp;lt;br /&amp;gt;&lt;br /&gt;
} else {&amp;lt;br /&amp;gt;&lt;br /&gt;
/* We are the parent. */&amp;lt;br /&amp;gt;&lt;br /&gt;
@@ -109,9 +124,17 @@&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
+ close( mypipe[1] );&amp;lt;br /&amp;gt;&lt;br /&gt;
/* Now, we wait for all the children to finish. */&amp;lt;br /&amp;gt;&lt;br /&gt;
- while( active );&amp;lt;br /&amp;gt;&lt;br /&gt;
+ do {&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int datalen = read( mypipe[0], &amp;amp;retData, sizeof(retData) );&amp;lt;br /&amp;gt;&lt;br /&gt;
+ if( datalen == sizeof(retData) ) {&amp;lt;br /&amp;gt;&lt;br /&gt;
+ matrixC[retData.y * MATRIX_SIZE + retData.x] = retData.value;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ }&amp;lt;br /&amp;gt;&lt;br /&gt;
+ if( datalen == 0 )&amp;lt;br /&amp;gt;&lt;br /&gt;
+ break;&amp;lt;br /&amp;gt;&lt;br /&gt;
+ } while( 1 );&amp;lt;br /&amp;gt;&lt;br /&gt;
printf( &amp;quot;Result:\n&amp;quot; );&amp;lt;br /&amp;gt;&lt;br /&gt;
print_matrix( matrixC );&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
--- ../src/wait-signal.c &amp;lt;br /&amp;gt;&lt;br /&gt;
+++ wait-signal-shm.c &amp;lt;br /&amp;gt;&lt;br /&gt;
@@ -3,6 +3,8 @@&amp;lt;br /&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/wait.h&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#include &amp;lt;signal.h&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
+#include &amp;lt;sys/ipc.h&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
+#include &amp;lt;sys/shm.h&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#define MATRIX_SIZE 5&amp;lt;br /&amp;gt;&lt;br /&gt;
@@ -77,9 +79,12 @@&amp;lt;br /&amp;gt;&lt;br /&gt;
int pid, x, y;&amp;lt;br /&amp;gt;&lt;br /&gt;
int matrixA[MATRIX_SIZE * MATRIX_SIZE];&amp;lt;br /&amp;gt;&lt;br /&gt;
int matrixB[MATRIX_SIZE * MATRIX_SIZE];&amp;lt;br /&amp;gt;&lt;br /&gt;
- int matrixC[MATRIX_SIZE * MATRIX_SIZE];&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int * matrixC;&amp;lt;br /&amp;gt;&lt;br /&gt;
/* Initialize the matricies. */&amp;lt;br /&amp;gt;&lt;br /&gt;
+ int id_shm = shmget( IPC_PRIVATE, sizeof(matrixC), IPC_CREAT | 0600 );&amp;lt;br /&amp;gt;&lt;br /&gt;
+ matrixC = shmat( id_shm, 0, 0 );&amp;lt;br /&amp;gt;&lt;br /&gt;
+&amp;lt;br /&amp;gt;&lt;br /&gt;
init_matrix( matrixA, 0 );&amp;lt;br /&amp;gt;&lt;br /&gt;
init_matrix( matrixB, 1 );&amp;lt;br /&amp;gt;&lt;br /&gt;
memset( matrixC, 0x00, sizeof(matrixC) );&amp;lt;br /&amp;gt;&lt;br /&gt;
@@ -102,6 +107,7 @@&amp;lt;br /&amp;gt;&lt;br /&gt;
if( pid == 0 ) {&amp;lt;br /&amp;gt;&lt;br /&gt;
/* We are the child. */&amp;lt;br /&amp;gt;&lt;br /&gt;
int value = calc_elem( matrixA, matrixB, x, y );&amp;lt;br /&amp;gt;&lt;br /&gt;
+ matrixC[y * MATRIX_SIZE + x] = value;&amp;lt;br /&amp;gt;&lt;br /&gt;
return value;&amp;lt;br /&amp;gt;&lt;br /&gt;
} else {&amp;lt;br /&amp;gt;&lt;br /&gt;
/* We are the parent. */&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5570</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5570"/>
		<updated>2010-11-25T13:03:22Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Fork &amp;amp; Exec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: When the parent closes the pipe, the child is sent a SIGPIPE signal when it tries to write to the pipe and the default action for a SIGPIPE signal is to terminate the program, hence the printf never runs. The program had another bug in that there was a while(1) loop which would have run forever had the process not been killed by the SIGPIPE signal. The while(1) loop, however, does not explain why the child died at all and the fact that the child exited at all should have been an obvious clue as to what was happening.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The lower 9 bits of the shmflg value.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A:&amp;lt;br /&amp;gt;• Read,Write and Execute for the Owner&amp;lt;br /&amp;gt;• Read andWrite for the Group&amp;lt;br /&amp;gt;• No permissions for everyone else&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: 0600 Any additional bits set represent a potential security issue in that additional processes not owned by the user may be able to interfere with the shared memory. The execute permission is not required in this question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: include/linux/sched.h&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Internal process name&lt;br /&gt;
!pid&lt;br /&gt;
|-&lt;br /&gt;
|State&lt;br /&gt;
|state&lt;br /&gt;
|-&lt;br /&gt;
|Owner&lt;br /&gt;
|uid, euid, suid, fsuid, gid, egid, sgid, fsgid&lt;br /&gt;
|-&lt;br /&gt;
|Execution Statistics &lt;br /&gt;
|sleep avg, last ran, utime, stime, nvcsw, nivcsw&lt;br /&gt;
|-&lt;br /&gt;
|Thread &lt;br /&gt;
|thread info&lt;br /&gt;
|-&lt;br /&gt;
|Related Processes &lt;br /&gt;
|parent, real parent, group leader&lt;br /&gt;
|-&lt;br /&gt;
|Child Processes &lt;br /&gt;
|children&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Here are all the flags you could have listed:&amp;lt;br /&amp;gt;• CLONE PARENT - Useful when one child wants to create another process but have it be a sibling instead of a child. In this way, a complex application can have a parent which takes care of administration and any of the children would be able to create additional processes that are also taken care of by the parent. If this flag did not exist, the child would have to ask the parent to create the new process.&amp;lt;br /&amp;gt;• CLONE FS - chroot is often useful when you want to have processes only have access to a part of the file system. It restricts within the kernel what directories the program can access. If this flag is set, a server could be started with access to the entire file system and then after initialization access could be restricted to just those directories needed by the server during operation. As an example, a web server could be started and after it is running the parent could perform a chroot and the child would then be restricted to only the part of the file system containing files which should be displayed by the web server (there are security problems associated with open file handles when doing a chroot, but we do not discuss them here).&amp;lt;br /&amp;gt;• CLONE FILES - If the child was to do work on a file handle, the parent (or dispatcher) could open files and then tell the child to operate on a specific file handle. Since file handles are simply integers, passing a file handle back and forth between processes only works if this option is enabled.&amp;lt;br /&amp;gt;• CLONE NEWNS - Useful if you only wanted a new mounted drive to be accessible to certain processes. You could mount the drive in a new namespace and then all processes not in that name-space would not be able to access the mounted drive (since the drive would not be mounted in their name-space). It gives a way of protecting data on the drive when access permissions are not sufficient.&amp;lt;br /&amp;gt;• CLONE SIGHAND - Allows a parent to catch signals that should be destined for the child process. This is especially useful when creating threads, where only one signal handler should be present for the group of threads (you don’t want different things happening depending on which thread generated the signal).&amp;lt;br /&amp;gt;• CLONE PTRACE - Allows debugging of children created by a parent process which is also being debugged.&amp;lt;br /&amp;gt;• CLONE VFORK - If a process wants to spawn off another program, it can use this option to block until the child has actually executed the new process. This prevents possible race conditions where the parent spawns off the child and then runs before the child has an opportunity to execute the replacement program.&amp;lt;br /&amp;gt;• CLONE VM - Sharing memory space is one of the basic desired traits when creating threads. It allows two threads to operate on the same data (with appropriate locking mechanisms of course).&amp;lt;br /&amp;gt;• CLONE PID - As it says, this is a hack. It allows creating a new process with the same PID so that when the parent exits, all other processes which refer to the process based on it’s pid will still be talking to the correct process.&amp;lt;br /&amp;gt;• CLONE THREAD - This results in a thread which shares the PID of the process. It is useful in conjunction with the CLONE VM function to create multiple threads which all share the same process ID and memory space.&amp;lt;br /&amp;gt;• CLONE SETTLS - Used by threading libraries. The description of this in the man page is not very clear.&amp;lt;br /&amp;gt;• CLONE PARENT SETTID- Used by threading libraries, itmakes the kernel write information on the thread to a specific location in memory, which is useful for keeping track of the threads.&amp;lt;br /&amp;gt;• CLONE CHILD SETTID - Used by threading libraries, it makes the kernel write information on the thread to a specific location in memory, which is useful for keeping track of the threads.&amp;lt;br /&amp;gt;• CLONE CHILD CLEARTID - Used by threading libraries, it forces the kernel to write information to the thread data structure in the parent when the child exits.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The key thing to note is that both sys clone() and sys fork() are implemented in terms of the same function, do fork(). To only expose one of these to userspace, you’d need to expose clone and implement the others it terms of it, because it is the system call that allows one to specify all of the arguments to do fork().&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* from arch/i386/kernel/process.c */&amp;lt;br /&amp;gt;&lt;br /&gt;
asmlinkage int sys_fork(struct pt_regs regs)&amp;lt;br /&amp;gt;&lt;br /&gt;
{&amp;lt;br /&amp;gt;&lt;br /&gt;
return do_fork(SIGCHLD, regs.esp, &amp;amp;regs, 0, NULL, NULL);&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
asmlinkage int sys_clone(struct pt_regs regs)&amp;lt;br /&amp;gt;&lt;br /&gt;
{&amp;lt;br /&amp;gt;&lt;br /&gt;
unsigned long clone_flags;&amp;lt;br /&amp;gt;&lt;br /&gt;
unsigned long newsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
int __user *parent_tidptr, *child_tidptr;&amp;lt;br /&amp;gt;&lt;br /&gt;
clone_flags = regs.ebx;&amp;lt;br /&amp;gt;&lt;br /&gt;
newsp = regs.ecx;&amp;lt;br /&amp;gt;&lt;br /&gt;
parent_tidptr = (int __user *)regs.edx;&amp;lt;br /&amp;gt;&lt;br /&gt;
child_tidptr = (int __user *)regs.edi;&amp;lt;br /&amp;gt;&lt;br /&gt;
if (!newsp)&amp;lt;br /&amp;gt;&lt;br /&gt;
newsp = regs.esp;&amp;lt;br /&amp;gt;&lt;br /&gt;
return do_fork(clone_flags, newsp, &amp;amp;regs, 0,&amp;lt;br /&amp;gt;&lt;br /&gt;
parent_tidptr, child_tidptr);&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* This is trivial, and on the face of it looks like it could equally well be done in user mode. Not so, for quite unobvious reasons - register pressure.In user mode vfork() cannot have a stack frame, and if done by calling the &amp;quot;clone()&amp;quot; system call directly, you do not have enough call-clobbered registers to hold all the information you need.*/&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
asmlinkage int sys_vfork(struct pt_regs regs)&amp;lt;br /&amp;gt;&lt;br /&gt;
{&amp;lt;br /&amp;gt;&lt;br /&gt;
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.esp,&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;regs, 0, NULL, NULL);&amp;lt;br /&amp;gt;&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Linux kernel has no knowledge that file descriptors 0, 1, and 2 are special— that is simply a convention of userspace. If you examine the code of sys open(), do sys open(), and get unused fd() in fs/open.c, you’ll see that there is no code referring to these file descriptors explicitly.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5569</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5569"/>
		<updated>2010-11-25T12:45:40Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Processes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: When the parent closes the pipe, the child is sent a SIGPIPE signal when it tries to write to the pipe and the default action for a SIGPIPE signal is to terminate the program, hence the printf never runs. The program had another bug in that there was a while(1) loop which would have run forever had the process not been killed by the SIGPIPE signal. The while(1) loop, however, does not explain why the child died at all and the fact that the child exited at all should have been an obvious clue as to what was happening.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The lower 9 bits of the shmflg value.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A:&amp;lt;br /&amp;gt;• Read,Write and Execute for the Owner&amp;lt;br /&amp;gt;• Read andWrite for the Group&amp;lt;br /&amp;gt;• No permissions for everyone else&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: 0600 Any additional bits set represent a potential security issue in that additional processes not owned by the user may be able to interfere with the shared memory. The execute permission is not required in this question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: include/linux/sched.h&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Internal process name&lt;br /&gt;
!pid&lt;br /&gt;
|-&lt;br /&gt;
|State&lt;br /&gt;
|state&lt;br /&gt;
|-&lt;br /&gt;
|Owner&lt;br /&gt;
|uid, euid, suid, fsuid, gid, egid, sgid, fsgid&lt;br /&gt;
|-&lt;br /&gt;
|Execution Statistics &lt;br /&gt;
|sleep avg, last ran, utime, stime, nvcsw, nivcsw&lt;br /&gt;
|-&lt;br /&gt;
|Thread &lt;br /&gt;
|thread info&lt;br /&gt;
|-&lt;br /&gt;
|Related Processes &lt;br /&gt;
|parent, real parent, group leader&lt;br /&gt;
|-&lt;br /&gt;
|Child Processes &lt;br /&gt;
|children&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5568</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5568"/>
		<updated>2010-11-25T12:36:30Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: When the parent closes the pipe, the child is sent a SIGPIPE signal when it tries to write to the pipe and the default action for a SIGPIPE signal is to terminate the program, hence the printf never runs. The program had another bug in that there was a while(1) loop which would have run forever had the process not been killed by the SIGPIPE signal. The while(1) loop, however, does not explain why the child died at all and the fact that the child exited at all should have been an obvious clue as to what was happening.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The lower 9 bits of the shmflg value.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A:&amp;lt;br /&amp;gt;• Read,Write and Execute for the Owner&amp;lt;br /&amp;gt;• Read andWrite for the Group&amp;lt;br /&amp;gt;• No permissions for everyone else&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: 0600 Any additional bits set represent a potential security issue in that additional processes not owned by the user may be able to interfere with the shared memory. The execute permission is not required in this question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5567</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5567"/>
		<updated>2010-11-25T12:35:47Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: When the parent closes the pipe, the child is sent a SIGPIPE signal when it tries to write to the pipe and the default action for a SIGPIPE signal is to terminate the program, hence the printf never runs. The program had another bug in that there was a while(1) loop which would have run forever had the process not been killed by the SIGPIPE signal. The while(1) loop, however, does not explain why the child died at all and the fact that the child exited at all should have been an obvious clue as to what was happening.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The lower 9 bits of the shmflg value.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A:• Read,Write and Execute for the Owner&amp;lt;br /&amp;gt;• Read andWrite for the Group&amp;lt;br /&amp;gt;• No permissions for everyone else&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: 0600 Any additional bits set represent a potential security issue in that additional processes not owned by the user may be able to interfere with the shared memory. The execute permission is not required in this question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5566</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5566"/>
		<updated>2010-11-25T12:34:49Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: When the parent closes the pipe, the child is sent a SIGPIPE signal when it tries to write to the pipe and the default action for a SIGPIPE signal is to terminate the program, hence the printf never runs. The program had another bug in&lt;br /&gt;
that there was a while(1) loop which would have run forever had the process not been killed by the SIGPIPE signal. The while(1) loop, however, does not explain why the child died at all and the fact that the child exited at all should have been an obvious clue as to what was happening.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The lower 9 bits of the shmflg value.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A:• Read,Write and Execute for the Owner&amp;lt;br /&amp;gt;• Read andWrite for the Group&amp;lt;br /&amp;gt;• No permissions for everyone else&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: 0600 Any additional bits set represent a potential security issue in that additional processes not owned by the user may be able to interfere with the shared memory. The execute permission is not required in this question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5565</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5565"/>
		<updated>2010-11-25T12:29:50Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The signal SIGTERM signal is normally sent unless a different signal is specified on the command line.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGCHLD, child handler alt );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: signal( SIGABRT, SIG IGN );&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: Below is the source for a “parent” and “child” execve programs (note there is only one process used by these programs!). The exec parent program opens the file foo and then passes the file descriptor number to exec child via its argument list. exec child reads up to the first 512 bytes of this file and writes them to standard out (fd 1). Note the file descriptor remains open (and if the fd is closed before the exec then the child fails).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;/* exec-parent.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;unistd.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;fcntl.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;int fd;&amp;lt;br /&amp;gt;char *child_argv[2];&amp;lt;br /&amp;gt;char fd_string[10];&amp;lt;br /&amp;gt;fd = open(&amp;quot;foo&amp;quot;, O_RDONLY);&amp;lt;br /&amp;gt;/* close(fd); */ /* Enable this to see exec_child fail! */&amp;lt;br /&amp;gt;snprintf(fd_string, 10, &amp;quot;%d&amp;quot;, fd);&amp;lt;br /&amp;gt;child_argv[0] = fd_string;&amp;lt;br /&amp;gt;child_argv[1] = NULL;&amp;lt;br /&amp;gt;&lt;br /&gt;
execve(&amp;quot;./exec-child&amp;quot;, child_argv, envp);&amp;lt;br /&amp;gt;fprintf(stderr, &amp;quot;Exec failed!\n&amp;quot;);&amp;lt;br /&amp;gt;return(-1);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;/* exec-child.c */&amp;lt;br /&amp;gt;#include &amp;lt;stdio.h&amp;gt;&amp;lt;br /&amp;gt;#include &amp;lt;stdlib.h&amp;gt;&amp;lt;br /&amp;gt;int main(int argc, char *argv[], char *envp[])&amp;lt;br /&amp;gt;{&amp;lt;br /&amp;gt;&lt;br /&gt;
char buf[512];&amp;lt;br /&amp;gt;int count,fd;&amp;lt;br /&amp;gt;fd = atoi(argv[0]);&amp;lt;br /&amp;gt;printf(&amp;quot;FD = %d\n&amp;quot;, fd);&amp;lt;br /&amp;gt;count = read(fd, buf, 512);&amp;lt;br /&amp;gt;if (count &amp;gt; 0) {&amp;lt;br /&amp;gt;printf(&amp;quot;First %d bytes of foo:\n&amp;quot;, count);&amp;lt;br /&amp;gt;write(1, buf, count);&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;printf(&amp;quot;Read of foo failed!\n&amp;quot;);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;printf(&amp;quot;Done!\n&amp;quot;);&amp;lt;br /&amp;gt;return(0);&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5564</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5564"/>
		<updated>2010-11-25T12:19:21Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Fork &amp;amp; Exec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The Clone function call is a much more powerful version of the fork system call. In fact, the functionality of the fork function call can be implemented with the clone function call. The clone function call, however, contains additional options which make it possible to create threads. The threads have the option of sharing file handles, memory spaces and other kernel resources.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: The file names may have been switched. Try using the wait-signal1.c for part 2 and wait-signal.c for part 3 - --[[User:AbsMechanik|AbsMechanik]] 15:11, 5 October 2010 (UTC)&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5563</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5563"/>
		<updated>2010-11-25T12:17:59Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Processes and Threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&amp;lt;br /&amp;gt;(a) Other processes on the system&amp;lt;br /&amp;gt;(b) Hardware (which interrupts the CPU to get serviced)&amp;lt;br /&amp;gt;(c) The CPU, memory, cache&amp;lt;br /&amp;gt;Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: The file names may have been switched. Try using the wait-signal1.c for part 2 and wait-signal.c for part 3 - --[[User:AbsMechanik|AbsMechanik]] 15:11, 5 October 2010 (UTC)&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5562</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5562"/>
		<updated>2010-11-25T12:14:05Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Processes and Threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&lt;br /&gt;
(a) Other processes on the system&lt;br /&gt;
(b) Hardware (which interrupts the CPU to get serviced)&lt;br /&gt;
(c) The CPU, memory, cache&lt;br /&gt;
Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;A: The program is blocking by busy waiting on the first character in the string. Busy waiting is bad because it ties up system resources needlessly. Furthermore, it is looking at the first character in the string, which means if a process switch&lt;br /&gt;
happened after the first character was written but before the rest of the string was written, then only the first part of the string would be displayed on the string (since the consumer would read the string before it was all completely there).&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: The file names may have been switched. Try using the wait-signal1.c for part 2 and wait-signal.c for part 3 - --[[User:AbsMechanik|AbsMechanik]] 15:11, 5 October 2010 (UTC)&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5561</id>
		<title>COMP 3000 Lab 3 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010_Soln&amp;diff=5561"/>
		<updated>2010-11-25T12:12:39Z</updated>

		<summary type="html">&lt;p&gt;Praman: Created page with &amp;quot;==Part A (Mandatory)==  ===Processes and Threads===  # The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consum…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/threads.c threads.c] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
 &lt;br /&gt;
A: This has to do with the fact that we have two processes running on a system without any sort of locking mechanism. This results in a race condition. If both processes ran for exactly the same amount every time you ran them, then the race condition would always appear at the same value. Unfortunately, this is not the case. There are a number of factors in a modern system which can affect the running time of a process. They include:&lt;br /&gt;
(a) Other processes on the system&lt;br /&gt;
(b) Hardware (which interrupts the CPU to get serviced)&lt;br /&gt;
(c) The CPU, memory, cache&lt;br /&gt;
Because of this, the scheduling of the two processes may look more like the diagram below, where the read lines indicate the servicing of an interrupt request. In order to always stop at the same number every time, each interrupt service would have to take exactly the same amount of time, and the processes would never be allowed to have their running time shortened or lengthened by even a few clock cycles. Being strict on execution time down to the clock cycle is not feasible on modern systems.&lt;br /&gt;
&lt;br /&gt;
# The program [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/passstr.c passstr.c] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal-1.c wait-signal-1.c] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: The file names may have been switched. Try using the wait-signal1.c for part 2 and wait-signal.c for part 3 - --[[User:AbsMechanik|AbsMechanik]] 15:11, 5 October 2010 (UTC)&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/pipe.c pipe.c]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [http://homeostasis.scs.carleton.ca/~soma/os-2010f/lab3/wait-signal.c wait-signal.c] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5194</id>
		<title>Operating Systems (Fall 2010)</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5194"/>
		<updated>2010-11-18T22:03:22Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Lectures and Deadlines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the main page for the Fall 2010 run of Carleton University&#039;s COMP 3000, Operating Systems.  The instructor for this course is [http://people.scs.carleton.ca/~soma Anil Somayaji]&lt;br /&gt;
&lt;br /&gt;
==Course Outline==&lt;br /&gt;
&lt;br /&gt;
The course outline for this course can be found [http://www.scs.carleton.ca/courses/course_outline.php?Number=COMP%203000&amp;amp;Term=Fall&amp;amp;Year=2010 here]&lt;br /&gt;
&lt;br /&gt;
==Class Help==&lt;br /&gt;
&lt;br /&gt;
The best way to get general help for this class is to email or IM &amp;quot;2010comp3000 at gmail dot com&amp;quot;.  TAs and the instructor will be monitoring this account.  For grade-specific questions, however, please email the TAs and/or the instructor directly using your Connect account.&lt;br /&gt;
&lt;br /&gt;
==Group assignments==&lt;br /&gt;
&lt;br /&gt;
Randomized group assignments for the essays are listed in WebCT.&lt;br /&gt;
&lt;br /&gt;
==Lectures and Deadlines==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 100%;&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Date&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Due/In Class&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Topics&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Readings&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Sept. 9th&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Class Outline&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 14th &amp;amp; 16th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;OS Overview&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 1&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 19th &amp;amp; 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 1 2010|Lab 1]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 28th &amp;amp; 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 2 2010|Lab 2]] [[COMP 3000 Lab 2 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 5th &amp;amp; 7th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 3 2010|Lab 3]] [[COMP 3000 Lab 3 2010 Soln|(Solutions)]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 1 2010|Assignment 1]] (Oct. 7th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 12th &amp;amp; 14th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 1 2010 Questions|Essay 1]] (Oct. 14th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 19th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm review 2010|Midterm review]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm exam 2010|Midterm exam]]&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;SA 515 and SA 624&amp;lt;/b&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 26th &amp;amp; 28th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Input/Output&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 2nd &amp;amp; 4th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 4 2010|Lab 4]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 9th &amp;amp; 11th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 5 2010|Lab 5]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 16 &amp;amp; 18th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 6 2010|Lab 6]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 2|Assignment 2]] (Nov. 18th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Virtual Machines&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 23 &amp;amp; 25th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 2 2010|Essay 2]] (Nov. 25th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Distributed OSs&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Security&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 9&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 2nd&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;The Future of Operating Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 9th, 19:00&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Final Exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5189</id>
		<title>Operating Systems (Fall 2010)</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=5189"/>
		<updated>2010-11-18T17:57:55Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Lectures and Deadlines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the main page for the Fall 2010 run of Carleton University&#039;s COMP 3000, Operating Systems.  The instructor for this course is [http://people.scs.carleton.ca/~soma Anil Somayaji]&lt;br /&gt;
&lt;br /&gt;
==Course Outline==&lt;br /&gt;
&lt;br /&gt;
The course outline for this course can be found [http://www.scs.carleton.ca/courses/course_outline.php?Number=COMP%203000&amp;amp;Term=Fall&amp;amp;Year=2010 here]&lt;br /&gt;
&lt;br /&gt;
==Class Help==&lt;br /&gt;
&lt;br /&gt;
The best way to get general help for this class is to email or IM &amp;quot;2010comp3000 at gmail dot com&amp;quot;.  TAs and the instructor will be monitoring this account.  For grade-specific questions, however, please email the TAs and/or the instructor directly using your Connect account.&lt;br /&gt;
&lt;br /&gt;
==Group assignments==&lt;br /&gt;
&lt;br /&gt;
Randomized group assignments for the essays are listed in WebCT.&lt;br /&gt;
&lt;br /&gt;
==Lectures and Deadlines==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 100%;&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Date&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Due/In Class&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Topics&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Readings&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Sept. 9th&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Class Outline&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 14th &amp;amp; 16th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;OS Overview&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 1&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 19th &amp;amp; 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 1 2010|Lab 1]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 28th &amp;amp; 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 2 2010|Lab 2]] [[COMP 3000 Lab 2 2010 Soln|(Solutions)]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 5th &amp;amp; 7th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 3 2010|Lab 3]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 1 2010|Assignment 1]] (Oct. 7th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 12th &amp;amp; 14th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 1 2010 Questions|Essay 1]] (Oct. 14th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 19th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm review 2010|Midterm review]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Midterm exam 2010|Midterm exam]]&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;SA 515 and SA 624&amp;lt;/b&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 26th &amp;amp; 28th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Input/Output&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 2nd &amp;amp; 4th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 4 2010|Lab 4]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 9th &amp;amp; 11th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 5 2010|Lab 5]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 16 &amp;amp; 18th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 6 2010|Lab 6]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 2|Assignment 2]] (Nov. 18th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Virtual Machines&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 23 &amp;amp; 25th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 2 2010|Essay 2]] (Nov. 25th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Distributed OSs&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Security&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 9&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 2nd&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;The Future of Operating Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 9th, 19:00&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Final Exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5188</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5188"/>
		<updated>2010-11-18T17:53:57Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Dynamic Libraries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;}else {&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A.&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;int main() {&amp;lt;br /&amp;gt;if( fork() == 0 ) {&amp;lt;br /&amp;gt;return 0;&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;wait( NULL );&amp;lt;br /&amp;gt;sleep( 1 );&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Read,Write, Execute&amp;lt;/b&amp;gt;&lt;br /&gt;
# What does it mean to have execute permission on a directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Can change into the directory.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;br/&amp;gt;• Read: Allows files or folders to be opened as read-only and to be copied.&amp;lt;br/&amp;gt;• Write: Allows the creation of files and folders; allows data to be added to or removed from files.&amp;lt;br/&amp;gt;• List Folder Contents: As per Read but also allows navigation of sub-folders.&amp;lt;br/&amp;gt;• Read and Execute: As per Read but also allows users to run executable files.&amp;lt;br/&amp;gt;• Modify: All the above as well as the permission to delete the file or folder.&amp;lt;br/&amp;gt;• Full Control: Full Control – including the ability to change ACLs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Modify allows you to delete the file or folder.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: The Sticky bit.&amp;lt;/b&amp;gt;&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are super-sets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Yes. File 1 (G1-R), File 2 (G2-R), File 3 (G1-R, G2-W).&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Dictates where to look for executable programs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: DISPLAY&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Different Versions of the DLL. No standard location for the DLL. Hard to determine&lt;br /&gt;
when no application is installed which uses the DLL.&amp;lt;/b&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5187</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5187"/>
		<updated>2010-11-18T17:53:03Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;}else {&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A.&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;int main() {&amp;lt;br /&amp;gt;if( fork() == 0 ) {&amp;lt;br /&amp;gt;return 0;&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;wait( NULL );&amp;lt;br /&amp;gt;sleep( 1 );&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Read,Write, Execute&amp;lt;/b&amp;gt;&lt;br /&gt;
# What does it mean to have execute permission on a directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Can change into the directory.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;br/&amp;gt;• Read: Allows files or folders to be opened as read-only and to be copied.&amp;lt;br/&amp;gt;• Write: Allows the creation of files and folders; allows data to be added to or removed from files.&amp;lt;br/&amp;gt;• List Folder Contents: As per Read but also allows navigation of sub-folders.&amp;lt;br/&amp;gt;• Read and Execute: As per Read but also allows users to run executable files.&amp;lt;br/&amp;gt;• Modify: All the above as well as the permission to delete the file or folder.&amp;lt;br/&amp;gt;• Full Control: Full Control – including the ability to change ACLs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Modify allows you to delete the file or folder.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: The Sticky bit.&amp;lt;/b&amp;gt;&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are super-sets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Yes. File 1 (G1-R), File 2 (G2-R), File 3 (G1-R, G2-W).&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Dictates where to look for executable programs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: DISPLAY&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5186</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5186"/>
		<updated>2010-11-18T17:51:22Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;}else {&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A.&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;int main() {&amp;lt;br /&amp;gt;if( fork() == 0 ) {&amp;lt;br /&amp;gt;return 0;&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;wait( NULL );&amp;lt;br /&amp;gt;sleep( 1 );&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Read,Write, Execute&amp;lt;/b&amp;gt;&lt;br /&gt;
# What does it mean to have execute permission on a directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Can change into the directory.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;br/&amp;gt;• Read: Allows files or folders to be opened as read-only and to be copied.&amp;lt;br/&amp;gt;• Write: Allows the creation of files and folders; allows data to be added to or removed from files.&amp;lt;br/&amp;gt;• List Folder Contents: As per Read but also allows navigation of sub-folders.&amp;lt;br/&amp;gt;• Read and Execute: As per Read but also allows users to run executable files.&amp;lt;br/&amp;gt;• Modify: All the above as well as the permission to delete the file or folder.&amp;lt;br/&amp;gt;• Full Control: Full Control – including the ability to change ACLs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Modify allows you to delete the file or folder.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: The Sticky bit.&amp;lt;/b&amp;gt;&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are super-sets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Yes. File 1 (G1-R), File 2 (G2-R), File 3 (G1-R, G2-W).&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Dictates where to look for executable programs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&amp;lt;/br&amp;gt;&amp;lt;b&amp;gt;A: DISPLAY&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5185</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5185"/>
		<updated>2010-11-18T17:49:43Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Permissions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;}else {&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A.&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;int main() {&amp;lt;br /&amp;gt;if( fork() == 0 ) {&amp;lt;br /&amp;gt;return 0;&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;wait( NULL );&amp;lt;br /&amp;gt;sleep( 1 );&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Read,Write, Execute&amp;lt;/b&amp;gt;&lt;br /&gt;
# What does it mean to have execute permission on a directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Can change into the directory.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;br/&amp;gt;• Read: Allows files or folders to be opened as read-only and to be copied.&amp;lt;br/&amp;gt;• Write: Allows the creation of files and folders; allows data to be added to or removed from files.&amp;lt;br/&amp;gt;• List Folder Contents: As per Read but also allows navigation of sub-folders.&amp;lt;br/&amp;gt;• Read and Execute: As per Read but also allows users to run executable files.&amp;lt;br/&amp;gt;• Modify: All the above as well as the permission to delete the file or folder.&amp;lt;br/&amp;gt;• Full Control: Full Control – including the ability to change ACLs.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Modify allows you to delete the file or folder.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: The Sticky bit.&amp;lt;/b&amp;gt;&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are super-sets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Yes. File 1 (G1-R), File 2 (G2-R), File 3 (G1-R, G2-W).&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5184</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5184"/>
		<updated>2010-11-18T17:45:39Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Processes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;}else {&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A.&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;int main() {&amp;lt;br /&amp;gt;if( fork() == 0 ) {&amp;lt;br /&amp;gt;return 0;&amp;lt;br /&amp;gt;} else {&amp;lt;br /&amp;gt;wait( NULL );&amp;lt;br /&amp;gt;sleep( 1 );&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5183</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5183"/>
		<updated>2010-11-18T17:39:36Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the&lt;br /&gt;
person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;} &amp;lt;br/&amp;gt;else {&amp;lt;br/&amp;gt;wait( NULL );&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5182</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5182"/>
		<updated>2010-11-18T17:39:01Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Permissions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the&lt;br /&gt;
person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;} &amp;lt;br/&amp;gt;else {&amp;lt;br/&amp;gt;wait( NULL );&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5181</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5181"/>
		<updated>2010-11-18T17:38:23Z</updated>

		<summary type="html">&lt;p&gt;Praman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: root&amp;lt;/b&amp;gt;&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: shadow&amp;lt;/b&amp;gt;&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file? &amp;lt;brr /&amp;gt;&amp;lt;b&amp;gt;A: No&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&amp;lt;br /&amp;gt;A: Allow the second (child) bash process to see the environment variable.&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: linux-gate, libproc, libncurses, libc, libdl, ld-linux&amp;lt;/b&amp;gt;&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: ld, nss compat, nsl, nss nis, nss files&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: fork creates a new process, exec replaces the running program in the current process with a new program.&amp;lt;/b&amp;gt;&lt;br /&gt;
# What is a zombie process?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: A process which has finished running but has not had it’s return value read by the&lt;br /&gt;
person who started it yet.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;A:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;int main() {&amp;lt;br/&amp;gt;if( fork() == 0 ) {&amp;lt;br/&amp;gt;return 0;&amp;lt;br/&amp;gt;} &amp;lt;br/&amp;gt;else {&amp;lt;br/&amp;gt;wait( NULL );&amp;lt;br/&amp;gt;sleep( 1 );&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;}&amp;lt;br/&amp;gt;&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5180</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5180"/>
		<updated>2010-11-18T17:20:38Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Shell Basics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: /usr/X11R6/bin&amp;lt;/b&amp;gt;&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: tcsh&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: -a&amp;lt;/b&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: bash runs in parallel, exec bash replaces it.&amp;lt;/b&amp;gt;&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: gnome-terminal or maybe xterm (note that other answers are possible)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
Each application running on a system is assigned a unique process identifier.  The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command shows the process identifiers for running processes.  Each process running on the system is kept separated from other processes by the operating system.  This information will be useful for subsequent questions.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&lt;br /&gt;
A: root&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&lt;br /&gt;
A: shadow&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&lt;br /&gt;
A: no&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&lt;br /&gt;
declare a global variable&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&lt;br /&gt;
&lt;br /&gt;
Linux-gate.so.1, libproc, libncurses, libc, libdl, /lib/ld-linux&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&lt;br /&gt;
# What is a zombie process?&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5179</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5179"/>
		<updated>2010-11-18T17:14:39Z</updated>

		<summary type="html">&lt;p&gt;Praman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Change data segment size&amp;lt;/b&amp;gt;&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A: Type the q key&amp;lt;/b&amp;gt;&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&lt;br /&gt;
/usr/bin/top&lt;br /&gt;
tcsh&lt;br /&gt;
ls -a&lt;br /&gt;
bash: open a new one.&lt;br /&gt;
exec bash: replace the old one&lt;br /&gt;
init--gnome-terminal--bash&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
Each application running on a system is assigned a unique process identifier.  The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command shows the process identifiers for running processes.  Each process running on the system is kept separated from other processes by the operating system.  This information will be useful for subsequent questions.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&lt;br /&gt;
A: root&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&lt;br /&gt;
A: shadow&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&lt;br /&gt;
A: no&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&lt;br /&gt;
declare a global variable&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&lt;br /&gt;
&lt;br /&gt;
Linux-gate.so.1, libproc, libncurses, libc, libdl, /lib/ld-linux&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&lt;br /&gt;
# What is a zombie process?&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5178</id>
		<title>COMP 3000 Lab 2 2010 Soln</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_2_2010_Soln&amp;diff=5178"/>
		<updated>2010-11-18T17:00:12Z</updated>

		<summary type="html">&lt;p&gt;Praman: Created page with &amp;quot;=Part A (Mandatory)=  ===Help===  #When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Part A (Mandatory)=&lt;br /&gt;
&lt;br /&gt;
===Help===&lt;br /&gt;
&lt;br /&gt;
#When working in the shell, help is available on most programs in the system, especially those that are command line based.  This system of help is available by using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command.  If one wanted to get help on the echo command, the associated command would be &amp;lt;tt&amp;gt;man echo&amp;lt;/tt&amp;gt;.  What does &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; stand for?&amp;lt;br /&amp;gt;&amp;lt;b&amp;gt;A:Manual&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command can also be used to get help on standard C functions.  Briefly (in one line), what does the C function &amp;lt;tt&amp;gt;brk&amp;lt;/tt&amp;gt; do?&lt;br /&gt;
# How do you quit the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command?&lt;br /&gt;
===Shell Basics===&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt; command can be used to figure out what directory an executable program resides in.  Using this command, what directory contains the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command?&lt;br /&gt;
# &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; is your default shell.  Which of the following is another shell that can be used instead of BASH?&amp;lt;tt&amp;gt; mv, cat, bc, tcsh, or arch &amp;lt;/tt&amp;gt;&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command can be used to get a listing of the files in a directory.  What options are passed to &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; to see all of the files within a directory (including hidden files)?&lt;br /&gt;
# The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command is used to get a list of processes which are running on the system.  Start a new shell from bash by running &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;.  Does the new shell replace or run in parallel with the old BASH shell?  What about &amp;lt;tt&amp;gt;exec bash&amp;lt;/tt&amp;gt;?  You can use the &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command to determine if bash is still running.&lt;br /&gt;
# Because each process is started by some other process, there is a process tree structure on the system.  From within your bash terminal, determine what process started BASH by using the &amp;lt;tt&amp;gt;pstree&amp;lt;/tt&amp;gt; command.  What graphical application can give you the same information?&lt;br /&gt;
/usr/bin/top&lt;br /&gt;
tcsh&lt;br /&gt;
ls -a&lt;br /&gt;
bash: open a new one.&lt;br /&gt;
exec bash: replace the old one&lt;br /&gt;
init--gnome-terminal--bash&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
Each application running on a system is assigned a unique process identifier.  The &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt; command shows the process identifiers for running processes.  Each process running on the system is kept separated from other processes by the operating system.  This information will be useful for subsequent questions.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
Your permission to access a file in Unix is determined by who you are logged in as.  All files on the Unix file system (including directories and other special files) have three different sets of permissions. The first set permissions denotes the allowed file operations for the owner of the file.  The second set of permissions denotes the allowed file operations for a group of users.  The third set of permissions denotes the allowed file operations for everyone else.  A&lt;br /&gt;
file is always owned by someone and is always associated with a group.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command with the &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option can be used to show both the permissions of a file as well as the owner and group associated with the file.  Permissions are listed first, followed by the owner and the group.&lt;br /&gt;
&lt;br /&gt;
#Who is the owner of the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory?&lt;br /&gt;
A: root&lt;br /&gt;
# What group is associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&lt;br /&gt;
A: shadow&lt;br /&gt;
# Each user is a member of some number of groups.  You can determine what groups you are part of by using the &amp;lt;tt&amp;gt;groups&amp;lt;/tt&amp;gt; command. Based on the groups listed, would you (the ``student&#039;&#039; user in the lab) be a member of the group associated with the &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt; file?&lt;br /&gt;
A: no&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
The environment on both Linux and Windows contains variable - value pairs which are useful to applications running on the system.  In Linux, these environment variables can be printed on the command line by referring to the variable name prefixed with a $ sign (eg: to output the value in the HELLO environment variable, one could write &amp;lt;tt&amp;gt;echo $HELLO&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
# On the command line, run the following two sets of commands.  Notice that the bash command will start a new shell separate from the shell that the HELLO environment variable was set in.&lt;br /&gt;
&lt;br /&gt;
 HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
 export HELLO=&amp;quot;Hi There&amp;quot;&lt;br /&gt;
 bash&lt;br /&gt;
 echo $HELLO&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
What does the export command seem to do?&lt;br /&gt;
declare a global variable&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Most applications on the system do not contain all the code that they need right within the executable.  Instead, dynamic libraries are loaded into the program address space when the program loads.  As an example, the standard C library, which contains such functions as &amp;lt;tt&amp;gt;printf&amp;lt;/tt&amp;gt; is loaded in at run-time.&lt;br /&gt;
&lt;br /&gt;
# Using &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, what dynamic library dependencies does the &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; command have?&lt;br /&gt;
# In addition to the libraries listed as dependencies for the application &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt;, there may be other libraries that the application loads dynamically at run-time.  Retrieve the process number &amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt; for the &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; process (using &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) and examine the map file located at &amp;lt;tt&amp;gt;/proc/&amp;lt;/tt&amp;gt;&amp;lt;em&amp;gt;PID&amp;lt;/em&amp;gt;&amp;lt;tt&amp;gt;/maps&amp;lt;/tt&amp;gt;.  What other dynamic libraries have been loaded into the application while it has been running?&lt;br /&gt;
&lt;br /&gt;
Linux-gate.so.1, libproc, libncurses, libc, libdl, /lib/ld-linux&lt;br /&gt;
&lt;br /&gt;
=Part B (Optional)=&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; function in a UNIX environment?&lt;br /&gt;
# What is a zombie process?&lt;br /&gt;
# Give an example C program which creates a zombie process.  Note that &amp;lt;tt&amp;gt;BASH&amp;lt;/tt&amp;gt; by default will collect and destroy zombie processes and so you will need to avoid bash destroying the zombie process during debugging.  This can be done by delaying the parent exit (using sleep is one good way to do this).&lt;br /&gt;
# Perform the modifications to your program above to avoid creating a zombie process.  List the new program.&lt;br /&gt;
&lt;br /&gt;
==Permissions==&lt;br /&gt;
&lt;br /&gt;
# Permissions on Unix are grouped into three basic file operations. What are these file operations?&lt;br /&gt;
# What does it mean to have execute permission on a directory?&lt;br /&gt;
# What are the 6 basic file permissions within Windows?&lt;br /&gt;
# What is the difference between the write and modify file permission in Windows?&lt;br /&gt;
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command may prove useful).&lt;br /&gt;
# In Windows, a file can be associated with more than one group and each group can have different access permissions.  On Unix, new groups can be created by the system administrator which are supersets of other groups.  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows?  If yes, give an example.  If no, explain why.&lt;br /&gt;
&lt;br /&gt;
==Environment==&lt;br /&gt;
&lt;br /&gt;
# What does the PATH environment variable do?&lt;br /&gt;
# What environment variable tells X applications where to find the X server which it should communicate with to display the output?&lt;br /&gt;
&lt;br /&gt;
==Dynamic Libraries==&lt;br /&gt;
&lt;br /&gt;
Dynamic libraries allow one copy of executable code to be used by&lt;br /&gt;
many different processes on the system, without requiring that&lt;br /&gt;
multiple copies of the code be stored on disk in different files.&lt;br /&gt;
What are some problems that can arise when different programs use the&lt;br /&gt;
same common DLLs (hint: ``DLL Hell&#039;&#039;)?&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_1_2010_Question_2&amp;diff=3043</id>
		<title>Talk:COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_1_2010_Question_2&amp;diff=3043"/>
		<updated>2010-10-12T14:46:38Z</updated>

		<summary type="html">&lt;p&gt;Praman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Not in this group and I&#039;m not completely sure if this is relevant but I found that UNIX used the POSIX standard while Linux used LSB which is based on the POSIX standard. &lt;br /&gt;
This article outlines some conflicts between them [https://www.opengroup.org/platform/single_unix_specification/uploads/40/13450/POSIX_and_Linux_Application_Compatibility_Final_-_v1.0.pdf]. I didn&#039;t find the actual comparisons very comprehensible but the ideas are there. --[[User:Slay|Slay]] 15:05, 7 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Uh, where did Figure 1 and much of the current text come from?  It looks like it was cut and pasted from random source.  Please don&#039;t plagarize!  --[[User:Soma|Anil]] (19:24, 8 October 2010 (UTC))&lt;br /&gt;
&lt;br /&gt;
Look into the reference article &amp;quot;Kernel command using Linux system calls&amp;quot;. Plagiarism is not my goal. I&#039;m using my own words to make a simple but complete description of a system call using the interrupt method. Check the references and If you think it is too close, please let me know. It is hard when an author makes such a good and clear description.--[[User:Sblais2|Sblais2]] 21:02, 8 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I thought it would be nice to first describe what is a system calls and the two current methods of doing them. The first is the interrupt method. The second which is used in Linux 2.6.18+ is using the sysenter and sysexit instructions.--[[User:Sblais2|Sblais2]] 19:56, 8 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
You can&#039;t use that figure.  And you can&#039;t copy the text either, even if you change the words slightly.  But really, you&#039;re just wasting your time.  This question is not talking about how system calls are invoked; if you wanted to discuss this, you should be discussing system call invocation mechanisms on the PDP-11 and VAX systems!  Here I&#039;m interested in what are the calls, i.e., kernel functions that can be invoked by a regular program.--[[User:Soma|Anil]]&lt;br /&gt;
&lt;br /&gt;
This link provides about 40 UNIX system calls along with example on where they would be used from the looks of it: [http://www.di.uevora.pt/~lmr/syscalls.html]. --[[User:Apharan2|Apharan2]]&lt;br /&gt;
&lt;br /&gt;
Thank you for clarifying things. I will go that route. --[[User:Sblais2|Sblais2]] 13:08, 12 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I don&#039;t see everyone contributing to this group. Please do let the others in your group know, divide your work into sections and discuss here. If you have questions - ask.--[[User:praman|Preeti]]&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2318</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2318"/>
		<updated>2010-10-04T15:17:02Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [[threads.c]] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program [[passstr.c]] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [[wait-signal.c]]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [[wait-signal.c]] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [[wait-signal-1.c]] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [[pipe.c]]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the [[wait-signal.c]] program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify [[wait-signal.c]] to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2317</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2317"/>
		<updated>2010-10-04T15:16:16Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [[threads.c]] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program [[passstr.c]] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [[wait-signal.c]]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [[wait-signal.c]] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [[wait-signal-1.c]] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [[pipe.c]]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2316</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2316"/>
		<updated>2010-10-04T15:15:10Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [[threads.c]] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program [[passstr.c]] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in [[wait-signal.c]]. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the [[wait-signal.c]] file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the [[wait-signal.c]] file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run [[pipe.c]]. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2315</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2315"/>
		<updated>2010-10-04T15:13:17Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Processes and Threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [[threads.c]] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program [[passstr.c]] is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2314</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2314"/>
		<updated>2010-10-04T15:12:56Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Processes and Threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program [[threads.c]] is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2313</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2313"/>
		<updated>2010-10-04T14:35:41Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Part A (Mandatory) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;fork&amp;lt;/tt&amp;gt; function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2312</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2312"/>
		<updated>2010-10-04T14:28:01Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the clone function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the clone and the fork function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The kill command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an exec call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2311</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2311"/>
		<updated>2010-10-04T14:27:44Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* IPC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the clone function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the clone and the fork function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The kill command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an exec call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will&lt;br /&gt;
need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2310</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2310"/>
		<updated>2010-10-04T14:27:33Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Part B (Optional) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the clone function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the clone and the fork function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The kill command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an exec call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
In this section, you will be modifying the program wait-signal to correctly compute the value of the matrix multiplication.&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Describe in words how you might modify the wait-signal program to correctly pass back the value computed in the child to the parent using only signals. Remember that signals do not allow data to be passed back and forth. Also keep in mind that there are only around 32 signals that can be sent to a process. You do not have to implement your answer, only describe what&lt;br /&gt;
you would do.&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify the wait-signal.c program to pass the appropriate matrix data back to the parent via a pipe. Remember that you will also have to pass back the x and y locations that the data should be put in. What is your updated main function?&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Modify wait-signal.c to send data back to the main process using shared memory. You will&lt;br /&gt;
need to use the functions shmget and shmat.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2309</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2309"/>
		<updated>2010-10-04T14:25:17Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Part B (Optional) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the clone function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the clone and the fork function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The kill command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an exec call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;br /&gt;
&lt;br /&gt;
===Processes===&lt;br /&gt;
#From class, you know that the process descriptor contains numerous information about a running process on the system. The task structure in Linux is called struct task struct. By examining the source of the Linux kernel, determine what source file this structure is defined in. The grep command may be useful in locating the correct file.&lt;br /&gt;
# Figure 6.3 (page 213) in your textbook contains a list of common elements found in a process table. Determine at least one variable in the Linux task structure which is related to each element listed in Figure 6.3. You may omit address space and stack.&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
# Examining the flags that can be passed to the clone function call. Choose 5 flags and describe a situation in which each of them would be useful.&amp;lt;br /&amp;gt;Find the portion of the Linux kernel that implements the fork, clone, and vfork system calls for i386 systems. Based upon this code, could Linux instead just have one of these system calls?&amp;lt;br /&amp;gt; If so, which one, and how would you implement userspace “wrappers” that would provide identical functionality for the other two calls?&amp;lt;br /&amp;gt;If not, why are all three necessary? Explain.(For this question, ignore issues of binary compatibility.)&lt;br /&gt;
# File descriptors 0, 1, and 2 are special in Linux, in that they refer to standard in, standard out, and standard error. Does the Linux kernel know they are special? Explain, referring to appropriate parts of the Linux kernel source.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2308</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2308"/>
		<updated>2010-10-04T14:16:59Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Part A (Mandatory) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the clone function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
===Fork &amp;amp; Exec===&lt;br /&gt;
&lt;br /&gt;
# What is the difference between the clone and the fork function call?&lt;br /&gt;
&lt;br /&gt;
===IPC===&lt;br /&gt;
&lt;br /&gt;
Examine the program given in wait-signal.c. It multiplies two matrices together using the standard trivial algorithm (which also happens to be a n3 algorithm). It spawns off a child process to compute the value of each element in the resulting matrix. The program has a problem, however, in that it fails to pass the resulting values back to the parent process in order to give the right result. In this section, we will examine various methods for passing data between processes.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;b&amp;gt;Signals&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Signals can be sent to each process running on the system. Signals, however, don’t allow the passing of any data along with the signal. Therefore, they are most useful for triggering actions.&amp;lt;br /&amp;gt;&lt;br /&gt;
## The kill command actually sends signals to processes. What signal does the kill command by default send to a process?&lt;br /&gt;
## Modify the wait-signal-1.c file to use the signal function to install the signal handler instead of the sigaction function call. You can have it install the child handler alt signal handler instead of the child handler signal handler. What line did you add to install the signal handler to child handler alt?&lt;br /&gt;
## Modify the wait-signal.c file to ignore the abort signal. What line did you have to add to do this?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Pipes&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;Pipes (also called FIFO’s) allow two processes to communicate through a file handle. One process writes data into a file handle and the other process can then read that data out through a related but different file handle.&lt;br /&gt;
## What happens to file descriptors across an exec call? Write a small program that tests this behavior, i.e. that opens a file, calls execve, and then the new program attempts to read from the previously opened file descriptor. Explain how this program behaves.&lt;br /&gt;
## Compile and run pipe.c. Notice how data is sent through the pipe by writing to one end of the pipe in the child and reading from the other end of the pipe in the parent. Also notice how the message Finished writing the data! is never displayed on the screen. The problem has to do with the SIGPIPE signal. What is the problem?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &amp;lt;b&amp;gt;Shared Memory&amp;lt;/b&amp;gt;&lt;br /&gt;
## Shared memory regions are controlled by the kernel to prevent other processes from accessing the memory without permission. Like files in Unix, the shared memory regions are given read, write and execute permission. These permissions are specified in the call to shmget. Where in the arguments to shmget are the permissions specified?&lt;br /&gt;
## The permissions must be specified as a value. By reading the manpage of chmod, determine what the permission 0760 means.&lt;br /&gt;
## What number is going to be required in order for two processes owned by the same user to be able to read and write to the shared memory?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2306</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2306"/>
		<updated>2010-10-04T13:41:20Z</updated>

		<summary type="html">&lt;p&gt;Praman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please answer all questions below. &lt;br /&gt;
&lt;br /&gt;
Part A is designed to be done in the lab while part B is designed to be done on your own time. Many of the questions require you to compile and run sample programs. These programs can be compiled using either the Corel Lab computers or your SCS Linux account.&lt;br /&gt;
&lt;br /&gt;
For all questions asking you to modify source code, you should always start with a clean version of the source code and modify that (unless otherwise directed in the question). Don’t continue modifying your solution to a previous question in order to answer the next question.&lt;br /&gt;
&lt;br /&gt;
All programs given in this assignment are written in C. A makefile is provided to compile the core programs given by the assignment—type “make” to compile. If you wish to rename files, you will need to either edit the makefile or run GCC to compile the programs on your own.&lt;br /&gt;
&lt;br /&gt;
==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
===Processes and Threads===&lt;br /&gt;
&lt;br /&gt;
# The program threads.c is a multithreaded producer/consumer program. Unfortunately it consumes faster than it produces, resulting in an error. Why does it not print the same number every time?&lt;br /&gt;
# The program passstr.c is a multithreaded program using the clone function call. What is wrong with the way this program blocks, waiting for the string to arrive in the buffer?&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=2304</id>
		<title>Operating Systems (Fall 2010)</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_(Fall_2010)&amp;diff=2304"/>
		<updated>2010-10-04T13:32:22Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Lectures and Deadlines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the main page for the Fall 2010 run of Carleton University&#039;s COMP 3000, Operating Systems.  The instructor for this course is [http://people.scs.carleton.ca/~soma Anil Somayaji]&lt;br /&gt;
&lt;br /&gt;
==Course Outline==&lt;br /&gt;
&lt;br /&gt;
The course outline for this course can be found [http://www.scs.carleton.ca/courses/course_outline.php?Number=COMP%203000&amp;amp;Term=Fall&amp;amp;Year=2010 here]&lt;br /&gt;
&lt;br /&gt;
==Class Help==&lt;br /&gt;
&lt;br /&gt;
The best way to get general help for this class is to email or IM &amp;quot;2010comp3000 at gmail dot com&amp;quot;.  TAs and the instructor will be monitoring this account.  For grade-specific questions, however, please email the TAs and/or the instructor directly using your Connect account.&lt;br /&gt;
&lt;br /&gt;
==Group assignments==&lt;br /&gt;
&lt;br /&gt;
Randomized group assignments for the essays are listed in WebCT.&lt;br /&gt;
&lt;br /&gt;
==Lectures and Deadlines==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;width: 100%;&amp;quot; border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Date&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Due/In Class&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Topics&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th&amp;gt;&lt;br /&gt;
    &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt;Readings&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Sept. 9th&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;Class Outline&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;p&amp;gt;&lt;br /&gt;
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 14th &amp;amp; 16th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;OS Overview&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 1&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 19th &amp;amp; 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 1 2010|Lab 1]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Sept. 28th &amp;amp; 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 2 2010|Lab 2]]&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Processes &amp;amp; Threads (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 2&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 5th &amp;amp; 7th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Lab 3 2010|Lab 3]]&amp;lt;br&amp;gt;[[COMP 3000 Assignment 1 2010|Assignment 1]] (Oct. 7th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 12th &amp;amp; 14th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;[[COMP 3000 Essay 1 2010 Questions|Essay 1]] (Oct. 14th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;File Systems (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 19th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Midterm review&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 21st&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Midterm exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Oct. 26th &amp;amp; 28th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Input/Output&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 2nd &amp;amp; 4th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Lab 4&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 9th &amp;amp; 11th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Lab 5&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Memory Management (cont.)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 16 &amp;amp; 18th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Lab 6&amp;lt;br&amp;gt;Assignment 2 (Nov. 18th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Virtual Machines&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.3&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 23 &amp;amp; 25th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Essay 2 (Nov. 25th)&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Distributed OSs&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Section 8.4&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Nov. 30th&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Security&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Chap. 9&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Dec. 2nd&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;The Future of Operating Systems&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;TBA&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;Final Exam&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td&amp;gt;&lt;br /&gt;
      &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2303</id>
		<title>COMP 3000 Lab 3 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_3_2010&amp;diff=2303"/>
		<updated>2010-10-04T13:31:31Z</updated>

		<summary type="html">&lt;p&gt;Praman: Created page with &amp;#039;==Part A (Mandatory)==  This part is to be completed in class.  You may add or edit tips after each question; please do not edit the original question, however.  ==Part B (Option…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Assignment_1_2010&amp;diff=2245</id>
		<title>COMP 3000 Assignment 1 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Assignment_1_2010&amp;diff=2245"/>
		<updated>2010-09-27T10:44:29Z</updated>

		<summary type="html">&lt;p&gt;Praman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please make an attempt to answer all of the following questions.  While all of them can potentially require long answers, you should be able to come up with the outline of an answer to each with a few searches.  If you cannot understand the questions even after referring to the textbook and online resources, try to answer the question by saying what you do and don&#039;t understand about it.&lt;br /&gt;
&lt;br /&gt;
# To what extent can exokernels be seen as a compromise between virtual machines and microkernels?  Explain how the key design characteristics of these three system architectures compare with each other.&lt;br /&gt;
# How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX?  How has the system call interface been expanded, and why?  Focus on major changes or extensions in functionality.&lt;br /&gt;
# To what extent do modern Windows systems provide mainframe-equivalent functionality?  What about Windows coupled with add-on commercial products such as VMWare&#039;s virtualization and EMC&#039;s storage solutions?  Explain.&lt;br /&gt;
# What &amp;quot;operating systems&amp;quot; have been implemented in the following languages: LISP, Modula-3, Smalltalk, Java?  To what extent do these systems match the capabilities of operating systems implemented in C and C++?&lt;br /&gt;
# Compare and contrast the evolution of the default BSD/FreeBSD and Linux schedulers.&lt;br /&gt;
# What are some examples of notable systems that have failed due to flawed efforts at mutual exclusion and/or race conditions?  How significant was the failure in each case?&lt;br /&gt;
# How is it possible for systems to supports millions of threads or more within a single process?  What are the key design choices that make such systems work - and how do those choices affect the utility of such massively scalable thread implementations?&lt;br /&gt;
# What is the history of POSIX Threads (pthreads)?  Consider - does this history explain why UNIX was so late to implement support for multithreaded processes?&lt;br /&gt;
# What requirements distinguish the Zettabyte File System (ZFS) from traditional file systems?  How are those requirements realized in ZFS, and how do other operating systems address those same requirements?  (Please discuss legacy, current, and in-development systems.)&lt;br /&gt;
# How do the constraints of flash storage affect the design of flash-optimized file systems?  Explain by contrasting with hard disk-based file systems.&lt;br /&gt;
# Why are object stores an increasingly attractive building block for filesystems (as opposed to block-based stores)?  Explain.&lt;br /&gt;
# There have been multiple attempts to have operating systems use databases or database-like stores.  What have been some of the major past attempts at this?  What was their fate?  Why?  Key examples (not exhaustive): WinFS, ReiserFS, PalmOS, Newton OS, BeOS&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_1_2010&amp;diff=2222</id>
		<title>COMP 3000 Lab 1 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_1_2010&amp;diff=2222"/>
		<updated>2010-09-20T16:39:04Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Part A (Mandatory) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
# Create a virtual machine in VirtualBox for Ubuntu Linux and and install Ubuntu using the ISO image in C:\support\somayaji.&lt;br /&gt;
#*Create your disk image on your Desktop or on a USB stick.&lt;br /&gt;
#*Images on your desktop will be deleted when you log out; USB stick images will be slower to access.&lt;br /&gt;
#*USB sticks may need to be formatted with NTFS to support a VirtualBox image. &lt;br /&gt;
#*Create a fixed-sized disk to increase performance.  However, you&#039;ll then have to wait for the fixed-sized disk to be allocated.&lt;br /&gt;
#*If you wish, you can use the Ubuntu install ISO as a live CD image.  In this case you don&#039;t need to install to any virtual hard disks.&lt;br /&gt;
#Create an account on the class wiki.  If you choose not to use your connect username please email me with your real name and your wiki username.&lt;br /&gt;
# Install the guest additions to your Ubuntu guest.  What new capabilities do you get?&lt;br /&gt;
#*To install, first mount the guest additions ISO using the &amp;quot;Devices&amp;quot; VirtualBox menu option.&lt;br /&gt;
#*To run the additions script, start up a Terminal window and run &amp;quot;sudo sh /media/&amp;lt;VBOXADD...&amp;gt;/VBoxLinuxAdditions-x86.run&amp;quot;.&lt;br /&gt;
# How much RAM does the VM use on the host?  How much is available in the VM?&lt;br /&gt;
# Look at the Disk Utility application in Ubuntu.  What sort of storage hardware does it have?  How does this compare to the hardware on the Windows host?&lt;br /&gt;
# Look at /proc/cpuinfo in the Ubuntu guest - is the CPU the same as that reported by Windows?&lt;br /&gt;
# What about the PCI devices as reported by the command line program &amp;quot;lspci&amp;quot;?&lt;br /&gt;
# How does the performance of the VM compare to that of the host OS?  Examine GUI, disk, and network performance.&lt;br /&gt;
# Setup shared folders between the guest and host and verify that you can copy files both ways.  What does the shared folder look like to Ubuntu?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Feel free to add your tips for the above exercises here.&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_1_2010&amp;diff=2221</id>
		<title>COMP 3000 Lab 1 2010</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Lab_1_2010&amp;diff=2221"/>
		<updated>2010-09-20T16:36:00Z</updated>

		<summary type="html">&lt;p&gt;Praman: /* Part A (Mandatory) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Part A (Mandatory)==&lt;br /&gt;
&lt;br /&gt;
This part is to be completed in class.&lt;br /&gt;
&lt;br /&gt;
You may add or edit tips after each question; please do not edit the original question, however.&lt;br /&gt;
&lt;br /&gt;
# Create a virtual machine in VirtualBox for Ubuntu Linux and and install Ubuntu using the ISO image in C:\support\somayaji.&lt;br /&gt;
*Create your disk image on your Desktop or on a USB stick.&lt;br /&gt;
##Images on your desktop will be deleted when you log out; USB stick images will be slower to access.&lt;br /&gt;
##USB sticks may need to be formatted with NTFS to support a VirtualBox image. &lt;br /&gt;
##Create a fixed-sized disk to increase performance.  However, you&#039;ll then have to wait for the fixed-sized disk to be allocated.&lt;br /&gt;
##If you wish, you can use the Ubuntu install ISO as a live CD image.  In this case you don&#039;t need to install to any virtual hard disks.&lt;br /&gt;
#Create an account on the class wiki.  If you choose not to use your connect username please email me with your real name and your wiki username.&lt;br /&gt;
# Install the guest additions to your Ubuntu guest.  What new capabilities do you get?&lt;br /&gt;
##To install, first mount the guest additions ISO using the &amp;quot;Devices&amp;quot; VirtualBox menu option.&lt;br /&gt;
##To run the additions script, start up a Terminal window and run &amp;quot;sudo sh /media/&amp;lt;VBOXADD...&amp;gt;/VBoxLinuxAdditions-x86.run&amp;quot;.&lt;br /&gt;
# How much RAM does the VM use on the host?  How much is available in the VM?&lt;br /&gt;
# Look at the Disk Utility application in Ubuntu.  What sort of storage hardware does it have?  How does this compare to the hardware on the Windows host?&lt;br /&gt;
# Look at /proc/cpuinfo in the Ubuntu guest - is the CPU the same as that reported by Windows?&lt;br /&gt;
# What about the PCI devices as reported by the command line program &amp;quot;lspci&amp;quot;?&lt;br /&gt;
# How does the performance of the VM compare to that of the host OS?  Examine GUI, disk, and network performance.&lt;br /&gt;
# Setup shared folders between the guest and host and verify that you can copy files both ways.  What does the shared folder look like to Ubuntu?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Feel free to add your tips for the above exercises here.&lt;br /&gt;
&lt;br /&gt;
==Part B (Optional)==&lt;br /&gt;
&lt;br /&gt;
The following exercises are optional.&lt;/div&gt;</summary>
		<author><name>Praman</name></author>
	</entry>
</feed>