<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Operating_Systems_2021F_Lecture_13</id>
	<title>Operating Systems 2021F Lecture 13 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Operating_Systems_2021F_Lecture_13"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2021F_Lecture_13&amp;action=history"/>
	<updated>2026-04-06T04:46:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2021F_Lecture_13&amp;diff=23435&amp;oldid=prev</id>
		<title>Soma: /* Video */</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2021F_Lecture_13&amp;diff=23435&amp;oldid=prev"/>
		<updated>2021-11-04T23:56:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Video&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:56, 4 November 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Video==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Video==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Video from the lecture given on &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;October 21&lt;/del&gt;, 2021 is now available:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Video from the lecture given on &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;November 2&lt;/ins&gt;, 2021 is now available:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.m4v video]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.m4v video]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.cc.vtt auto-generated captions]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.cc.vtt auto-generated captions]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2021F_Lecture_13&amp;diff=23431&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;==Video==  Video from the lecture given on October 21, 2021 is now available: * [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.m4v...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2021F_Lecture_13&amp;diff=23431&amp;oldid=prev"/>
		<updated>2021-11-02T16:23:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Video==  Video from the lecture given on October 21, 2021 is now available: * [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.m4v...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Video==&lt;br /&gt;
&lt;br /&gt;
Video from the lecture given on October 21, 2021 is now available:&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.m4v video]&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/os-2021f/lectures/comp3000-2021f-lec13-20211102.cc.vtt auto-generated captions]&lt;br /&gt;
Video is also available through Brightspace (Resources-&amp;gt;Class zoom meetings-&amp;gt;Cloud Recordings tab)&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Lecture 13&lt;br /&gt;
----------&lt;br /&gt;
* Grading&lt;br /&gt;
  - A2 and the midterm are basically graded&lt;br /&gt;
  - will combine and post by Thursday&lt;br /&gt;
  - Thursday we&amp;#039;ll also go over midterm solutions&lt;br /&gt;
  - if your Tutorials 1-4 haven&amp;#039;t been graded, please talk to your TA,&lt;br /&gt;
    it is probably an oversight&lt;br /&gt;
  - if you do better on the final, the final grade will replace&lt;br /&gt;
    the midterm (as the final is cumulative)&lt;br /&gt;
* Interviews&lt;br /&gt;
  - will post schedule by Thursday&lt;br /&gt;
  - I will ask some of you to sign up, otherwise you may volunteer&lt;br /&gt;
  - if you want me to check questions that you think have been misgraded,&lt;br /&gt;
    please sign up for an interview (unless it is pretty brief)&lt;br /&gt;
  - I will also be doing interviews for the final&lt;br /&gt;
  - you can&amp;#039;t lose marks, but I could report you to the Dean&lt;br /&gt;
* Tutorial 5&lt;br /&gt;
&lt;br /&gt;
By the way I&amp;#039;m very behind on messages &amp;amp; email, but will be catching up, will update on Thursday&lt;br /&gt;
&lt;br /&gt;
Generally the hardest thing in this tutorial is getting passwordless login to work for SSH&lt;br /&gt;
 - either you have a conceptual issue or you missed something small&lt;br /&gt;
 - working =&amp;gt; you got both right&lt;br /&gt;
 - if you have to type in a passphrase to unlock your key, it is still &amp;quot;passwordless&amp;quot;&lt;br /&gt;
    - the remote machine never sees the password&lt;br /&gt;
    - you can get rid of the passphrase if you wish&lt;br /&gt;
&lt;br /&gt;
To restart the system, you can either do &amp;quot;sudo reboot&amp;quot; or&lt;br /&gt;
  &amp;quot;sudo shutdown -r now&amp;quot;&lt;br /&gt;
  - but you shouldn&amp;#039;t do that for chsh&lt;br /&gt;
  - just log out and log back in, or log in separately&lt;br /&gt;
  - if I&amp;#039;m running a backup that I want to finish before shutting down, I&amp;#039;ll&lt;br /&gt;
    do &amp;quot;sudo shutdown -h +15&amp;quot;, so the system will &amp;quot;halt&amp;quot; in 15 minutes.&lt;br /&gt;
&lt;br /&gt;
The only time when you must reboot is when the kernel gets upgraded&lt;br /&gt;
 - other reboots for updates can be bypassed, but sometimes it is a pain&lt;br /&gt;
   to restart all the services that need to be restarted&lt;br /&gt;
 - I should note there are ways to patch the kernel without rebooting&lt;br /&gt;
   but it only works for some updates&lt;br /&gt;
 - if you can&amp;#039;t login with the new user, try &amp;quot;sudo service sshd restart&amp;quot;&lt;br /&gt;
    - that will restart sshd&lt;br /&gt;
    - check syntax?&lt;br /&gt;
&lt;br /&gt;
When you do setuid before setgid, the setgid should fail because you no longer have higher privileges&lt;br /&gt;
 - if it doesn&amp;#039;t fail, you haven&amp;#039;t dropped privileges yet&lt;br /&gt;
&lt;br /&gt;
Windows has to reboot all the time because processes by default lock files that are in use&lt;br /&gt;
 - and services are using files all the time&lt;br /&gt;
&lt;br /&gt;
UNIX systems do not lock files that are in use.&lt;br /&gt;
  - we&amp;#039;ll discuss this more very shortly&lt;br /&gt;
&lt;br /&gt;
process uid&amp;#039;s&lt;br /&gt;
 - there&amp;#039;s actually a uid and an euid&lt;br /&gt;
 - uid: who &amp;quot;owns&amp;quot; the process&lt;br /&gt;
   - they can kill it&lt;br /&gt;
 - euid: what privileges the process has&lt;br /&gt;
 - normally uid=euid&lt;br /&gt;
    - then euid isn&amp;#039;t shown&lt;br /&gt;
 - but when a binary is setuid, its euid is set to the uid of the file&lt;br /&gt;
    - the uid of the process remains unchanged&lt;br /&gt;
&lt;br /&gt;
Setuid binaries are used to give controlled access to privileged resources&lt;br /&gt;
 - i.e., passwd &amp;amp; chsh allow changes to /etc/passwd, /etc/shadow&lt;br /&gt;
   that are owned by root&lt;br /&gt;
 - execve checks for the setuid bit on the binary being loaded,&lt;br /&gt;
   if it is set it changes the euid of the process to the uid of the file&lt;br /&gt;
   (otherwise it leaves it unchanged)&lt;br /&gt;
 - if there is a vulnerability in a setuid root binary, then an attacker&lt;br /&gt;
   can get full root access through it&lt;br /&gt;
     - that&amp;#039;s why setuid binaries are shown in red, they are dangerous&lt;br /&gt;
     &lt;br /&gt;
Same thing for gid and egid&lt;br /&gt;
 - when you use groups to manage access&lt;br /&gt;
&lt;br /&gt;
It is time to talk more about files &amp;amp; filesystems&lt;br /&gt;
&lt;br /&gt;
In UNIX like systems, there are the following kinds of files&lt;br /&gt;
 - regular files&lt;br /&gt;
 - directories (d)&lt;br /&gt;
 - symbolic links (s)&lt;br /&gt;
 - character devices (c)&lt;br /&gt;
    - unbuffered character devices (u), not often used&lt;br /&gt;
 - block devices (b)&lt;br /&gt;
 - pipes (p)  &amp;lt;--- mkpipe&lt;br /&gt;
&lt;br /&gt;
If it isn&amp;#039;t a file, directory, or symbolic link, it is a &amp;quot;special file&amp;quot;&lt;br /&gt;
 - we&amp;#039;ll cover special files later&lt;br /&gt;
 - can make them with mknod&lt;br /&gt;
&lt;br /&gt;
Note that these aren&amp;#039;t really file &amp;quot;types&amp;quot;&lt;br /&gt;
 - regular files just have extensions, e.g., .txt, but they are optional&lt;br /&gt;
 - applications can use them or ignore them, the OS doesn&amp;#039;t care&lt;br /&gt;
&lt;br /&gt;
What is a filename?&lt;br /&gt;
 - it is a key in a hierarchical key/value store&lt;br /&gt;
   - the file is the key associated with a value&lt;br /&gt;
 - but it is *not* just for storing data&lt;br /&gt;
 - counter example: /proc&lt;br /&gt;
   - if you do cat /proc/cpuinfo, you aren&amp;#039;t getting data from disk,&lt;br /&gt;
     you&amp;#039;re asking the kernel what CPUs it has&lt;br /&gt;
 - &amp;quot;linear array of bytes&amp;quot;, yes...but those bytes don&amp;#039;t have to&lt;br /&gt;
   come from fixed storage, they can be generated on the fly&lt;br /&gt;
&lt;br /&gt;
In UNIX-like systems, files are kind of universal&lt;br /&gt;
 - used for all kinds of things other than storing data&lt;br /&gt;
 - uniform API (open, read, write, etc.) that can be applied to&lt;br /&gt;
   almost anything&lt;br /&gt;
&lt;br /&gt;
Cool thing about a universal API is it allows for programs to be connected and&lt;br /&gt;
to work together without a-priori agreeing on a way to interact&lt;br /&gt;
 - they are just interacting with &amp;quot;files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Not everything is a file in UNIX, but lots of things are&lt;br /&gt;
 - the designers of UNIX created Plan 9 later, and there everything&lt;br /&gt;
   really is a file (never caught on, but that&amp;#039;s where /proc came from)&lt;br /&gt;
 - network stuff is mostly not in files (folks at Berkeley made that choice)&lt;br /&gt;
   - has a special API, can&amp;#039;t just use open/read/write&lt;br /&gt;
   &lt;br /&gt;
a-priori =&amp;gt; what you know in advance&lt;br /&gt;
&lt;br /&gt;
In UNIX there is one namespace for files&lt;br /&gt;
 - all files must exist in /...&lt;br /&gt;
 - no drive letters, etc&lt;br /&gt;
&lt;br /&gt;
namespace&lt;br /&gt;
 - all values in it &amp;quot;mean&amp;quot; the same thing&lt;br /&gt;
&lt;br /&gt;
in a namespace, two things can&amp;#039;t have the same name&lt;br /&gt;
 - each name is unique&lt;br /&gt;
&lt;br /&gt;
if you have multiple name spaces, you can have the &amp;quot;same&amp;quot; name in different namespaces&lt;br /&gt;
 - can differentiate by noting the namespace each are in&lt;br /&gt;
&lt;br /&gt;
But we can put whatever we want into that file hierarchy&lt;br /&gt;
 - normally we put different kinds of things in different directories&lt;br /&gt;
   - /proc, /dev, and /usr are very different&lt;br /&gt;
     (talk to the kernel, special files, and system files)&lt;br /&gt;
   - if you plug in a USB stick, it will probably show up in /media/&amp;lt;username&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
When I say hierarchy, I mean tree&lt;br /&gt;
 - think family tree, or trees from 2402&lt;br /&gt;
&lt;br /&gt;
How do we combine different kinds of files all together &lt;br /&gt;
&lt;br /&gt;
Our file hierarchy is actually showing files from many different sources&lt;br /&gt;
 - each source is called a &amp;quot;filesystem&amp;quot;&lt;br /&gt;
 - we add filesystems to the file hierarchy by &amp;quot;mounting&amp;quot; the filesystem&lt;br /&gt;
&lt;br /&gt;
We can see all the filesystems by just running &amp;quot;mount&amp;quot;&lt;br /&gt;
 - filesystems with storage can be seen with &amp;quot;df&amp;quot; (dump filesystems)&lt;br /&gt;
&lt;br /&gt;
Inside a filesystem, all the files are &amp;quot;the same&amp;quot; (will explain this in a bit)&lt;br /&gt;
 - look at the devices associated with each filesystem, they vary&lt;br /&gt;
 - some correspond to actual storage devices, but many don&amp;#039;t&lt;br /&gt;
&lt;br /&gt;
What actually happens when you open and access a file depends upon the filesystem it is part of&lt;br /&gt;
 - in fact, the kernel virtualizes the file interface, allows&lt;br /&gt;
   each filesystem to implement their own versions of file operations (open,&lt;br /&gt;
   read, etc)&lt;br /&gt;
&lt;br /&gt;
When you add a user, they don&amp;#039;t get a filesystem&lt;br /&gt;
 - they just get a home directory&lt;br /&gt;
 - by default in /home nowadays, but can be just about anywhere&lt;br /&gt;
&lt;br /&gt;
When filesystems are mounted, the files in the filesystem go under a&lt;br /&gt;
mount point&lt;br /&gt;
 - a mount point is just an empty directory&lt;br /&gt;
 - mounting logically replaces the empty directory with files that&lt;br /&gt;
   are in the new filesystem&lt;br /&gt;
 - any directory can be a mount point for a new filesystem&lt;br /&gt;
   - if it isn&amp;#039;t empty, its files will be inaccessible until the new filesystem is unmounted&lt;br /&gt;
      - you&amp;#039;ve taken away their names&lt;br /&gt;
&lt;br /&gt;
In Tutorial 6 we&amp;#039;ll be playing with filesystems&lt;br /&gt;
&lt;br /&gt;
If you want to read the textbook&amp;#039;s treatment of filesystems, it will help&lt;br /&gt;
 - the textbook authors are experts in filesystems&lt;br /&gt;
&lt;br /&gt;
a key concept in UNIX filesystems: inodes&lt;br /&gt;
&lt;br /&gt;
filenames refer to inodes&lt;br /&gt;
inodes refer to data&lt;br /&gt;
&lt;br /&gt;
inodes are a level of indirection between filenames and file data&lt;br /&gt;
 - we want it because in UNIX, an inode can have multiple file names,&lt;br /&gt;
   and this is core to how UNIX works&lt;br /&gt;
&lt;br /&gt;
(indirection - like a pointer to a pointer)&lt;br /&gt;
virtual functions in C++, that&amp;#039;s indirection&lt;br /&gt;
pointers are a kind of indirection&lt;br /&gt;
&lt;br /&gt;
When you stat a file, you&amp;#039;re actually getting back info on the file&amp;#039;s inode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>