<?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_2019F_Lecture_14</id>
	<title>Operating Systems 2019F Lecture 14 - 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_2019F_Lecture_14"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2019F_Lecture_14&amp;action=history"/>
	<updated>2026-05-18T21:41:55Z</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_2019F_Lecture_14&amp;diff=22532&amp;oldid=prev</id>
		<title>Soma at 22:10, 30 October 2019</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2019F_Lecture_14&amp;diff=22532&amp;oldid=prev"/>
		<updated>2019-10-30T22:10:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:10, 30 October 2019&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 October 30, 2019 [https://homeostasis.scs.carleton.ca/~soma/os-2019f/lectures/comp3000-2019f-lec14-20191030.m4v is now available]. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(will be uploaded shortly)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Video from the lecture given on October 30, 2019 [https://homeostasis.scs.carleton.ca/~soma/os-2019f/lectures/comp3000-2019f-lec14-20191030.m4v 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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Notes==&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;==Notes==&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_2019F_Lecture_14&amp;diff=22531&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;==Video==  Video from the lecture given on October 30, 2019 [https://homeostasis.scs.carleton.ca/~soma/os-2019f/lectures/comp3000-2019f-lec14-20191030.m4v is now available]. (...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2019F_Lecture_14&amp;diff=22531&amp;oldid=prev"/>
		<updated>2019-10-30T21:42:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Video==  Video from the lecture given on October 30, 2019 [https://homeostasis.scs.carleton.ca/~soma/os-2019f/lectures/comp3000-2019f-lec14-20191030.m4v is now available]. (...&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 30, 2019 [https://homeostasis.scs.carleton.ca/~soma/os-2019f/lectures/comp3000-2019f-lec14-20191030.m4v is now available]. (will be uploaded shortly)&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Lecture 14&lt;br /&gt;
----------&lt;br /&gt;
&lt;br /&gt;
* midterm discussion on Friday&lt;br /&gt;
* tutorial grading&lt;br /&gt;
* next week&lt;br /&gt;
&lt;br /&gt;
* CPU modes&lt;br /&gt;
* OS kernel &amp;amp; userspace&lt;br /&gt;
* VFS &amp;amp; filesystems&lt;br /&gt;
* SSH&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tutorial grading&lt;br /&gt;
* 3 points for work&lt;br /&gt;
* 1 point for talking with TA&lt;br /&gt;
&lt;br /&gt;
What do we mean by an operating system kernel?&lt;br /&gt;
&lt;br /&gt;
CPUs run in different modes&lt;br /&gt;
 - there are multiple modes, but for this class we&amp;#039;ll focus on two&lt;br /&gt;
 - user mode and supervisor mode&lt;br /&gt;
   - processes run in user mode&lt;br /&gt;
   - the OS kernel runs in supervisor mode&lt;br /&gt;
 - in user mode, the CPU has limited access to resources&lt;br /&gt;
   - only memory for the current process&lt;br /&gt;
   - no direct hardware access&lt;br /&gt;
 - in supervisor mode, CPU has access to everything&lt;br /&gt;
   - all memory&lt;br /&gt;
   - all hardware&lt;br /&gt;
 - job of the kernel is to share and abstract resources for processes&lt;br /&gt;
   (code running in user mode on the CPU)&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ll be studying the Linux kernel&lt;br /&gt;
 - Windows, MacOS X all have functionally equivalent kernels&lt;br /&gt;
&lt;br /&gt;
We already have a way to interact with the kernel directly&lt;br /&gt;
 - /proc and /sys&lt;br /&gt;
 - every system call&lt;br /&gt;
&lt;br /&gt;
system calls are unlike function calls because...&lt;br /&gt;
&lt;br /&gt;
function calls&lt;br /&gt;
  - put arguments in registers, stack&lt;br /&gt;
  - call function (saves IP to stack)&lt;br /&gt;
  - function puts return value in register or stack&lt;br /&gt;
  - function calls ret, restores old IP&lt;br /&gt;
&lt;br /&gt;
system call&lt;br /&gt;
  - put argument in registers (maybe stack), including syscall number&lt;br /&gt;
  - issue syscall instruction&lt;br /&gt;
  - CPU switches to supervisor mode&lt;br /&gt;
  - CPU invokes system call dispatcher&lt;br /&gt;
     -- like a signal handler, but an &amp;quot;interrupt&amp;quot; handler&lt;br /&gt;
  - system call dispatcher calls system call handler&lt;br /&gt;
  - system call handler does work, returns&lt;br /&gt;
  - scheduler chooses process to run&lt;br /&gt;
  - CPU switches to user mode, starts executing selected process&lt;br /&gt;
 &lt;br /&gt;
  &lt;br /&gt;
CPUs have multiple &amp;quot;interrupts&amp;quot;&lt;br /&gt;
 - potential events&lt;br /&gt;
 - have handlers for each event&lt;br /&gt;
 - events can be created by hardware or by special instructions (eg syscall)&lt;br /&gt;
    - e.g., hard drives, keyboards, *timers*&lt;br /&gt;
 - kernel installs handlers on system startup&lt;br /&gt;
&lt;br /&gt;
Operating system code can be in a few places&lt;br /&gt;
 - the kernel &amp;lt;--- our focus&lt;br /&gt;
 - system processes&lt;br /&gt;
 - libraries in regular processes (applications can mess with this)&lt;br /&gt;
&lt;br /&gt;
On every UNIX system, process 1 is special&lt;br /&gt;
 - it is &amp;quot;init&amp;quot;, the process that starts all other processes&lt;br /&gt;
 - on modern Linux, &amp;quot;init&amp;quot; is systemd (and systemd has a lot more to it)&lt;br /&gt;
 - special because&lt;br /&gt;
   - it reaps orphan processes (with systemd, there are in effect inits for each user that handle this)&lt;br /&gt;
   - if it dies, the system shuts down&lt;br /&gt;
&lt;br /&gt;
On older systems, kill -9 1 was a fast way to shutdown/reboot a system (as root!)&lt;br /&gt;
 - not sure what it does today?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To the kernel, a file is just a thing that goes with certain system calls&lt;br /&gt;
 - open, read, write, lseek, mmap, close&lt;br /&gt;
 - for example, for open&lt;br /&gt;
   - takes filename, figures out which filesystem this corresponds to&lt;br /&gt;
   - finds &amp;quot;open&amp;quot; routine for that filesystem, calls it with rest of args&lt;br /&gt;
&lt;br /&gt;
So, a filesystem is an implementation of the main filesystem routines&lt;br /&gt;
 - for files, directories, and filesystem management&lt;br /&gt;
&lt;br /&gt;
A filesystem is an interface that can have many implementations&lt;br /&gt;
 - the &amp;quot;virtual file system&amp;quot; (VFS) interface in that interface!&lt;br /&gt;
 - structs of function pointers (because it is all C)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Secure shell (SSH)&lt;br /&gt;
------------------&lt;br /&gt;
* main functionality: give secure remote access to a shell&lt;br /&gt;
  - redirect standard in, out, error from remote process to local terminal or files&lt;br /&gt;
&lt;br /&gt;
* there were older ways to do this (telnet, rsh), but they go in the clear over the network, and so are very very insecure&lt;br /&gt;
&lt;br /&gt;
* SSH employs a mix of public key cryptography and symmetric key cryptography to secure connection&lt;br /&gt;
&lt;br /&gt;
* Similar to TLS/SSL, but different&lt;br /&gt;
&lt;br /&gt;
Public key cryptography&lt;br /&gt;
-----------------------&lt;br /&gt;
 - traditional codes &amp;amp; cyphers have symmetric keys&lt;br /&gt;
   - same key or code book used for encryption and decryption&lt;br /&gt;
&lt;br /&gt;
 - main limitation of symmetric key crypto: how do you share keys with strangers?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - public key crypto solves this by splitting keys into public and private keys&lt;br /&gt;
&lt;br /&gt;
In order to set up SSH public key authentication&lt;br /&gt;
 - generate a key pair, public and private&lt;br /&gt;
 - put public key in .ssh/authorized_keys on remote system&lt;br /&gt;
&lt;br /&gt;
Then to use, make sure your ssh client has access to the private key you generated&lt;br /&gt;
&lt;br /&gt;
Remember when you use SSH, both the remote system and you have public/private key pairs for identification!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Disks to UNIX are block devices&lt;br /&gt;
 - arrays of fixed-sized storage, e.g. 4096 bytes at a time&lt;br /&gt;
 - filesystems have to store files in this array somehow&lt;br /&gt;
&lt;br /&gt;
Formatting a filesystem&lt;br /&gt;
 - puts an empty filesystem data structure on storage (disk)&lt;br /&gt;
 - that data structure has to be robust&lt;br /&gt;
   - because it has to last for years potentially&lt;br /&gt;
   - should recover from simple corruption&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>