<?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_2022F_Lecture_15</id>
	<title>Operating Systems 2022F Lecture 15 - 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_2022F_Lecture_15"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2022F_Lecture_15&amp;action=history"/>
	<updated>2026-04-05T22:41:57Z</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_2022F_Lecture_15&amp;diff=24135&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;==Video==  Video from the lecture given on November 8, 2022 is now available: * [https://homeostasis.scs.carleton.ca/~soma/os-2022f/lectures/comp3000-2022f-lec15-20221108.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/os-2022f/lectures/comp3000-2022f-lec15-20221108.cc.vtt auto-generated captions] Video is also available through Brightspace (Resources-&gt;Zoom meeting-&gt;Cloud Recordings tab)  ==Notes==  &lt;pre&gt; Lecture 15 ----------  * Washer delivery happening shortly...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Operating_Systems_2022F_Lecture_15&amp;diff=24135&amp;oldid=prev"/>
		<updated>2022-11-09T02:21:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Video==  Video from the lecture given on November 8, 2022 is now available: * [https://homeostasis.scs.carleton.ca/~soma/os-2022f/lectures/comp3000-2022f-lec15-20221108.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/os-2022f/lectures/comp3000-2022f-lec15-20221108.cc.vtt auto-generated captions] Video is also available through Brightspace (Resources-&amp;gt;Zoom meeting-&amp;gt;Cloud Recordings tab)  ==Notes==  &amp;lt;pre&amp;gt; Lecture 15 ----------  * Washer delivery happening shortly...&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 November 8, 2022 is now available:&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/os-2022f/lectures/comp3000-2022f-lec15-20221108.m4v video]&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/os-2022f/lectures/comp3000-2022f-lec15-20221108.cc.vtt auto-generated captions]&lt;br /&gt;
Video is also available through Brightspace (Resources-&amp;gt;Zoom meeting-&amp;gt;Cloud Recordings tab)&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Lecture 15&lt;br /&gt;
----------&lt;br /&gt;
&lt;br /&gt;
* Washer delivery happening shortly, so I *may* have to step out for a few minutes, sorry&lt;br /&gt;
* A2 is graded, I just need to post, should be later today&lt;br /&gt;
* Midterm is being marked but we&amp;#039;ll need until next week, sorry&lt;br /&gt;
* update on Assignment 3&lt;br /&gt;
  - I have it mostly done but trying to figure out one thing, should be out in a day&lt;br /&gt;
  - but we&amp;#039;re going to talk about it today anyway&lt;br /&gt;
&lt;br /&gt;
Assignment 3 from Fall 2021: 3000makefs.sh&lt;br /&gt;
&lt;br /&gt;
* When you run this script, you get what seems like a new system&lt;br /&gt;
 - it has its own filesystem with its own /etc, /usr, /bin, and so on&lt;br /&gt;
&lt;br /&gt;
This is part of the tech used to build small Linux systems&lt;br /&gt;
&lt;br /&gt;
Key technologies to understand:&lt;br /&gt;
 - making a filesystem in a file&lt;br /&gt;
 - chroot to make this new filesystem /&lt;br /&gt;
 - busybox&lt;br /&gt;
&lt;br /&gt;
What is busybox?&lt;br /&gt;
 - one program that has the (basic) functionality of an entire UNIX/Linux system (userland)&lt;br /&gt;
    - with a Linux kernel + busybox, you have a functional Linux system&lt;br /&gt;
&lt;br /&gt;
So why don&amp;#039;t we use busybox all the time?&lt;br /&gt;
 - because its versions are rather basic&lt;br /&gt;
&lt;br /&gt;
How does a UNIX-like system start up?&lt;br /&gt;
 - three stages: bootloader, kernel startup, userland startup&lt;br /&gt;
 - the bootloader is responsible for loading the kernel&lt;br /&gt;
    - which may mean doing some hardware init&lt;br /&gt;
    - on modern Linux systems, most commonly this is GRUB&lt;br /&gt;
    - but can be a series of programs&lt;br /&gt;
 - the kernel then starts, this is what initializes the hardware,&lt;br /&gt;
   creates the process abstraction, manages all resources&lt;br /&gt;
    - we&amp;#039;ll be exploring this more soon&lt;br /&gt;
 - userland starts with init&lt;br /&gt;
    - basically, all the things you can see with ps is userland&lt;br /&gt;
      (but not the ones in [])&lt;br /&gt;
&lt;br /&gt;
 - the BIOS or EFI loads the bootloader&lt;br /&gt;
    - EFI can actually load a kernel directly&lt;br /&gt;
&lt;br /&gt;
&amp;quot;init&amp;quot; is the name given to the first process that runs on a UNIX system&lt;br /&gt;
 - always PID 1&lt;br /&gt;
 - it is its own parent process (the parent of 1 is 1)&lt;br /&gt;
 - when it terminates, the system shuts down&lt;br /&gt;
&lt;br /&gt;
Note that MOST processes sleep most of the time&lt;br /&gt;
 - background processes are waiting for something to do&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3000makefs uses chroot to have a new root filesystem&lt;br /&gt;
 - so we can&amp;#039;t see other filesystems unless we mount them from their devices&lt;br /&gt;
 - but we can still see the rest of the system&lt;br /&gt;
   - and in fact we aren&amp;#039;t really isolated at all from things&lt;br /&gt;
&lt;br /&gt;
Have you heard of containers?&lt;br /&gt;
 - basically the same as a chroot environment, except we also split up processes, users, etc - everything in userspace&lt;br /&gt;
 - idea is to make systems separate, even though they share a kernel&lt;br /&gt;
&lt;br /&gt;
Whenever you see a loopback device as the device associated with a filesystem,&lt;br /&gt;
it means the data for that filesystem is *in a file* on another filesystem&lt;br /&gt;
&lt;br /&gt;
/dev/loopX is just a device that is used to make a file behave like a block device&lt;br /&gt;
&lt;br /&gt;
So why is firefox and other software being distributed in containers?&lt;br /&gt;
 - because then Mozilla can package it up in a consistent way&lt;br /&gt;
   that will work the same on different systems&lt;br /&gt;
 - remember a container contains programs, libraries, and anything else you want&lt;br /&gt;
   - it is an &amp;quot;entire system&amp;quot;&lt;br /&gt;
 - to a first approximation then, anything else installed on the system can&amp;#039;t&lt;br /&gt;
   mess with how firefox works, because they are kept separate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any modern program depends on many files&lt;br /&gt;
 - libraries, system data, config data, etc&lt;br /&gt;
 - if it acts strange/has a bug, the problem could be with the files&lt;br /&gt;
   it depends on, and not its code&lt;br /&gt;
 - containers package all this up so you get a consistent execution environment&lt;br /&gt;
&lt;br /&gt;
Why are we using loopback devices?  To provide filesystem isolation&lt;br /&gt;
 - otherwise we can&amp;#039;t make sure files in one container don&amp;#039;t take away&lt;br /&gt;
   resources in another (say, a log file gets too big)&lt;br /&gt;
 &lt;br /&gt;
So where is the code for the kernel?&lt;br /&gt;
 - basic kernel image: in /boot, vmlinuz...&lt;br /&gt;
 - kernel modules: /lib/modules/&amp;lt;version&amp;gt;&lt;br /&gt;
 - modules are bits of kernel code that are run at runtime as needed&lt;br /&gt;
&lt;br /&gt;
When we talk about userspace, we are talking about regular programs and their files&lt;br /&gt;
When we talk about kernelspace, we are talking about the kernel &amp;amp; modules&lt;br /&gt;
 - note the kernel doesn&amp;#039;t load libraries or any other files generally&lt;br /&gt;
   - it facilitates programs accessing files&lt;br /&gt;
&lt;br /&gt;
We enter the kernel via two routes (which are two versions of the same interface):&lt;br /&gt;
  - system calls &amp;amp; interrupts (from timers, keyboard, hard drive, network, etc)&lt;br /&gt;
                              (also from dividing by zero, accessing&lt;br /&gt;
			       invalid memory (segfault))&lt;br /&gt;
			       &lt;br /&gt;
We exit the kernel via the scheduler&lt;br /&gt;
  - determines what process to run next&lt;br /&gt;
&lt;br /&gt;
Basic flow of control for a system call&lt;br /&gt;
&lt;br /&gt;
  Userspace                     Kernel space&lt;br /&gt;
  -------------------          ----------------&lt;br /&gt;
  make system call&lt;br /&gt;
                               start system call dispatcher&lt;br /&gt;
			       handle system call&lt;br /&gt;
			       call scheduler&lt;br /&gt;
			         - find progam that is in a runnable state&lt;br /&gt;
				 - start it&lt;br /&gt;
  continue chosen program&lt;br /&gt;
    execution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implicit above is lots of saving and restoring of CPU state&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that when we return to userspace after a system call, we *generally* aren&amp;#039;t going to run the process that made the system call next&lt;br /&gt;
  - we&amp;#039;ll run another process that was waiting&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you look in /proc and /sys, you are interacting directly with the kernel&lt;br /&gt;
 - interface to kernel data structures&lt;br /&gt;
 - but you access them using a filesystem interface&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>