<?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=Lianyingzhao</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=Lianyingzhao"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php/Special:Contributions/Lianyingzhao"/>
	<updated>2026-04-22T11:18:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_9&amp;diff=25041</id>
		<title>COMP3000 Operating Systems W25: Tutorial 9</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_9&amp;diff=25041"/>
		<updated>2025-03-15T15:17:16Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.  ==General Instructions (same for all tutorials)==  &amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt; Click on Expand to view. &amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt; Tutorials are graded based on participation and effo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By the end of this tutorial, you will have a basic familiarity with the Docker platform and be able to run, operate, and customize containers, and create simple containers of your own. You will see how kernel building blocks like namespaces make containers possible.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===Docker containers===&lt;br /&gt;
Docker is one of the OS-level virtualization technologies that allows the creation of isolated virtual execution environments, called containers, sharing the same OS kernel and certain runtime services/libraries with other containers. The workload running inside a container will feel as if it had its own everything, OS kernel, root file system, etc. This is possible thanks to the way Docker containers are designed and implemented. The Linux kernel does not directly support the construction of containers (the userspace libraries do) but its various building blocks play an important role, among which we will cover namespaces in this tutorial.&lt;br /&gt;
&lt;br /&gt;
===Docker images===&lt;br /&gt;
A Docker image is a file containing a root file system as well as configuration parameters. It is very similar to other disk image formats in this sense. One of the main differences is that it employs a layered file system to maximize storage efficiency and allow flexible reuse of existing files.&lt;br /&gt;
 &lt;br /&gt;
===Dockerfile===&lt;br /&gt;
A Dockerfile is a text file and serves as instructions to build a Docker image. Unlike storing and distributing binary data directly in images, using Dockerfiles can save space and rebuild the Docker image by always downloading the latest version of software.&lt;br /&gt;
&lt;br /&gt;
===Docker Registry===&lt;br /&gt;
The Registry is a server-side application containing and managing repositories of Docker images. We use Docker Hub (among other choices by different providers) to pull images from in this tutorial.&lt;br /&gt;
&lt;br /&gt;
===Namespaces===&lt;br /&gt;
Namespaces allow for multiple “spaces” where identical names can coexist. For example, the same process ID (PID) may refer to completely different processes. This is like how we can distinguish Tom (PID) in Ottawa (namespace) from Tom in Toronto (namespace). Namespaces are enforced by the OS kernel. They are the fundamental building block of containers.&lt;br /&gt;
&lt;br /&gt;
A few namespaces we will cover here: Mount (&amp;lt;tt&amp;gt;mnt&amp;lt;/tt&amp;gt;), Network (&amp;lt;tt&amp;gt;net&amp;lt;/tt&amp;gt;), User ID (&amp;lt;tt&amp;gt;uid&amp;lt;/tt&amp;gt;) and Process ID (&amp;lt;tt&amp;gt;pid&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
You can use the command &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; to see the namespaces the current process is in. A namespace ID is actually an &#039;&#039;&#039;inode&#039;&#039;&#039;. &lt;br /&gt;
 &lt;br /&gt;
Also, the command &amp;lt;tt&amp;gt;nsenter&amp;lt;/tt&amp;gt; allows you to run programs with namespaces of another process. Use the &amp;lt;tt&amp;gt;-t&amp;lt;/tt&amp;gt; option to specify the target PID. For instance, &amp;lt;tt&amp;gt;sudo nsenter -t 2772 -m ls /&amp;lt;/tt&amp;gt; will list the root file system of the mount namespace of process 2772.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
The purpose of the following questions and tasks is to help you understand how containers work, which is an important artifact on top of and based on modern operating systems. The focus is on the OS building blocks – how it is made possible by the OS. Docker is just a typical and popular example to facilitate understanding. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You need to &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; for all the &amp;lt;tt&amp;gt;docker&amp;lt;/tt&amp;gt; commands below&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Install Docker with &amp;lt;tt&amp;gt;sudo apt install docker.io&amp;lt;/tt&amp;gt; if it’s not already installed.&lt;br /&gt;
&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;docker images&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;docker ps&amp;lt;/tt&amp;gt; (similar to the purpose of &amp;lt;tt&amp;gt;ps&amp;lt;/tt&amp;gt;) to see what images you have and whether any containers are running. Run your first container with &amp;lt;tt&amp;gt;docker run hello-world&amp;lt;/tt&amp;gt;. Now, check the images and &amp;lt;tt&amp;gt;docker ps&amp;lt;/tt&amp;gt; again, what do you see and &amp;lt;u&amp;gt;why&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Look at the hello-world image above and you may wonder how the tiny-sized image forms a full container. Find out where the files are located (hint: using the command &amp;lt;tt&amp;gt;docker inspect&amp;lt;/tt&amp;gt; and looking for paths starting with &amp;lt;tt&amp;gt;/var/lib/docker&amp;lt;/tt&amp;gt;). What is the size of the found file? Run the file directly. &amp;lt;u&amp;gt;What do you think&amp;lt;/u&amp;gt; is the way the tiny-sized image forms the full container?&lt;br /&gt;
# &amp;lt;tt&amp;gt;docker ps -a&amp;lt;/tt&amp;gt; will show something different. Next, let’s try an image of a bit more complexity that will remain running. Try the centos (a Linux distribution) image: &amp;lt;tt&amp;gt;docker run -d centos sleep infinity&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;man docker-run&amp;lt;/tt&amp;gt; for the meaning of the options). &lt;br /&gt;
# Start a new shell: &amp;lt;tt&amp;gt;docker exec -it&amp;lt;/tt&amp;gt; &amp;lt;CONTAINER ID&amp;gt; &amp;lt;tt&amp;gt;/bin/bash&amp;lt;/tt&amp;gt; (you can find out the container ID with &amp;lt;tt&amp;gt;docker ps -a&amp;lt;/tt&amp;gt;. Note that you can specify just the first few digits of the ID as long as it’s distinctive). Explore the file system therein.&lt;br /&gt;
#; Next, we will examine the namespaces.&lt;br /&gt;
# Compare the mount namespaces (different views of the file system structure) between the centos container and the host, using &amp;lt;tt&amp;gt;ls -l /proc/self/ns/mnt&amp;lt;/tt&amp;gt;. Are they the same and if not, what are they (format: &amp;lt;tt&amp;gt;mnt:[????]&amp;lt;/tt&amp;gt;)? In particular, take a look at the root mount point (“&amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt;”) inside and outside the container (&amp;lt;tt&amp;gt;mount | grep &amp;quot;on / &amp;quot;&amp;lt;/tt&amp;gt;). You can always use two sessions (one in the container and one in the host) or &amp;lt;tt&amp;gt;tmux&amp;lt;/tt&amp;gt; as you feel convenient.&lt;br /&gt;
# With the &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; command, you can get an overview of all namespaces. Comparing the centos container and the host, &amp;lt;u&amp;gt;which namespaces are the same (shared) and which are different&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Inside the container, use the command &amp;lt;tt&amp;gt;id&amp;lt;/tt&amp;gt; to see what user you’re logged in as (uid, gid and group). Then &amp;lt;tt&amp;gt;ps -eo uid,gid,pid,command | grep sleep&amp;lt;/tt&amp;gt; inside the container and outside the container respectively. Are their outputs the same?&lt;br /&gt;
# Using the pid of “sleep” you have got outside the container above, find its pid namespace (&amp;lt;tt&amp;gt;sudo ls -l /proc/&amp;lt;pid&amp;gt;/ns/pid&amp;lt;/tt&amp;gt;, format &amp;lt;tt&amp;gt;pid:[????]&amp;lt;/tt&amp;gt;). Is it consistent with the &amp;lt;tt&amp;gt;lsns&amp;lt;/tt&amp;gt; output inside the container?&lt;br /&gt;
# From step 6, you have the individual namespaces used by the “sleep” container (no need to go inside the container again). Let’s check the network namespace (&amp;lt;tt&amp;gt;sudo nsenter -t &amp;lt;/tt&amp;gt;&amp;lt;pid&amp;gt;&amp;lt;tt&amp;gt; -n ip addr&amp;lt;/tt&amp;gt;). &lt;br /&gt;
#: Note that uid remapping is not enabled by default. So the user (uid) inside the container will be the same outside (which does not consider security).&lt;br /&gt;
# Now, make your own Docker container. Read the current [https://raw.githubusercontent.com/docker-library/hello-world/7ecae6978055d2fb6960e2a29d24a2af612e2716/amd64/hello-world/Dockerfile Dockerfile of hello-world]. Change it in a way that it is no longer from scratch but &#039;&#039;from &amp;lt;tt&amp;gt;hello-world &amp;lt;/tt&amp;gt;&#039;&#039;. Here we can avoid defining &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; as the default command as it works with a terminal for interaction (then it will inherit &amp;lt;tt&amp;gt;CMD&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt;). Build a new image called &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt; by doing the following: &lt;br /&gt;
#: &amp;lt;tt&amp;gt;mkdir anyname&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: copy your &amp;lt;tt&amp;gt;csimipleshell&amp;lt;/tt&amp;gt; and the Dockerfile of &amp;lt;tt&amp;gt;hello-world&amp;lt;/tt&amp;gt; into this directory&lt;br /&gt;
#: &amp;lt;tt&amp;gt;cd anyname&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: make necessary changes to the Dockerfile&lt;br /&gt;
#: &amp;lt;tt&amp;gt;docker build -t csimpleshell .&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Run the new csimpleshell container (e.g., &amp;lt;tt&amp;gt;docker run -it csimpleshell /csimpleshell&amp;lt;/tt&amp;gt;). Depending on &amp;lt;tt&amp;gt;how you compiled csimpleshell&amp;lt;/tt&amp;gt;, check whether the container runs or if it does whether csimpleshell works as before. Try compiling csimpleshell statically (if it was dynamic) and repeat the steps.&lt;br /&gt;
# Edit the Dockerfile again and make it from “centos” instead of “hello-world”. Remove any reference to hello. Rebuild and run it. How is csimpleshell now? &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is there such a difference?&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_8&amp;diff=25034</id>
		<title>COMP3000 Operating Systems W25: Tutorial 8</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_8&amp;diff=25034"/>
		<updated>2025-03-07T06:01:04Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;In this tutorial, you’ll be learning about how virtual addresses are mapped to physical addresses (the address translation) and continue to use kernel modules to extract information that only the kernel has access to. In particular, the kernel module performs a 5-level page table walk to find out the physical address corresponding to a userspace virtual address. In addition to what was discussed in the class, You can also read [https://en.wikipedia.org/wiki/Intel_5-lev...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial, you’ll be learning about how virtual addresses are mapped to physical addresses (the address translation) and continue to use kernel modules to extract information that only the kernel has access to. In particular, the kernel module performs a 5-level page table walk to find out the physical address corresponding to a userspace virtual address. In addition to what was discussed in the class, You can also read [https://en.wikipedia.org/wiki/Intel_5-level_paging more about 5-level paging], if interested.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
WARNING: The commands and programs in this tutorial are potentially extremely dangerous and may result in crashes or loss of data. Additionally, questions may not work as expected on a machine other than the course VM. For that reason, you are strongly encouraged to do this tutorial on the provided OpenStack or Virtualbox virtual machine.&lt;br /&gt;
&lt;br /&gt;
To get started, we will first examine the source code for &amp;lt;tt&amp;gt;3000physicalview.c&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;3000memview2.c&amp;lt;/tt&amp;gt;, both of which are in [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut8/3000physicalview.tar.gz 3000physicalview.tar.gz].&lt;br /&gt;
&lt;br /&gt;
==Tasks part A: Getting Started==&lt;br /&gt;
Compile &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt; using the provided &amp;lt;tt&amp;gt;Makefile&amp;lt;/tt&amp;gt; (i.e., by running &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Insert &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; by running &amp;lt;tt&amp;gt;make insert&amp;lt;/tt&amp;gt;. Confirm that the module is inserted using &amp;lt;tt&amp;gt;lsmod&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Examine the call to &amp;lt;tt&amp;gt;copy_from_user()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;copy_to_user()&amp;lt;/tt&amp;gt; on lines 120 and 132 of &amp;lt;tt&amp;gt;3000physicalview.c&amp;lt;/tt&amp;gt; (as also discussed in the lecture). Consider the following:&lt;br /&gt;
#* How are these functions different from &amp;lt;tt&amp;gt;get_user()&amp;lt;/tt&amp;gt;/&amp;lt;tt&amp;gt;put_user()&amp;lt;/tt&amp;gt; that we have seen in the previous tutorial?&lt;br /&gt;
#* Why are these functions necessary? Couldn&#039;t we just access the userspace address directly? What could happen if we did?&lt;br /&gt;
# &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; exposes its API to userspace in the form of an &amp;lt;tt&amp;gt;ioctl(2)&amp;lt;/tt&amp;gt; call. Consider the following:&lt;br /&gt;
#* What is an ioctl? How is it different from a read or write system call? Hint: check &amp;lt;tt&amp;gt;man 2 ioctl&amp;lt;/tt&amp;gt;.&lt;br /&gt;
#* How does &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; implement its ioctl? What arguments does it take?&lt;br /&gt;
#* How does &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt; call the ioctl? What arguments does it pass to the ioctl?&lt;br /&gt;
# Which function does the virtual-to-physical translation? What type is &amp;lt;tt&amp;gt;current-&amp;gt;mm&amp;lt;/tt&amp;gt;? How does it give you the address of the &amp;lt;tt&amp;gt;pgd&amp;lt;/tt&amp;gt;? Recall the page table walk explained in the lecture and see how it’s reflected in this function (writing it down is optional).&lt;br /&gt;
# Once you’ve got the page frame number (pfn), how is the physical address (phys) calculated? Describe in words.&lt;br /&gt;
&lt;br /&gt;
==Tasks part B: Examining Physical Memory Mappings==&lt;br /&gt;
# With &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; inserted, run &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt; and examine the output. Note that it presents virtual memory addresses on the left, and physical addresses on the right. Are these mappings consistent with what you expected (e.g., in terms of patterns)?&lt;br /&gt;
# Compare &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;3000memview&amp;lt;/tt&amp;gt; from Tutorial 2. What is similar about their code, and what is different? How similar is their output?&lt;br /&gt;
# Do you notice a pattern in the virtual addresses of &amp;lt;tt&amp;gt;buf[i]&amp;lt;/tt&amp;gt;? Is this same pattern present in the physical addresses? Why or why not?&lt;br /&gt;
# Run &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt; a few more times and consider the following:&lt;br /&gt;
#* Are the virtual addresses the same or different between runs? How about physical addresses?&lt;br /&gt;
#* Some physical addresses don&#039;t seem to be changing between runs. Which ones? Why do you think this might be the case?&lt;br /&gt;
# Force the kernel to drop the virtual memory cache using &amp;lt;tt&amp;gt;sync &amp;amp;&amp;amp; echo 3 | sudo tee /proc/sys/vm/drop_caches&amp;lt;/tt&amp;gt;. Run &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt; one more time and note that the physical addresses that stayed the same previously have now changed. What do you think just happened?&lt;br /&gt;
&lt;br /&gt;
==Tasks part C: Using &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt; to Monitor &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt;== &lt;br /&gt;
Now recall what you tried with eBPF in Tutorial 7. We can also do something similar to watch the interaction between &amp;lt;tt&amp;gt;3000physicalview&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;3000memview2&amp;lt;/tt&amp;gt;. &lt;br /&gt;
Note: No in-depth understanding of eBPF is expected in this course. You only need to understand what is involved and discussed. Feel free to read more if interested.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use the following &amp;quot;one-liner&amp;quot; (as it is just a one-line string within the single quotation marks) in a new terminal session first and in the orginal one run &amp;lt;tt&amp;gt;./3000memview2&amp;lt;/tt&amp;gt; as above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;sudo bpftrace -e &#039;tracepoint:syscalls:sys_enter_ioctl { printf(&amp;quot;%s: fd=%d; cmd=%d; arg=%ld \n&amp;quot;, comm, args-&amp;gt;fd, args-&amp;gt;cmd, args-&amp;gt;arg); }&#039; | grep 3000memview2&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does this one-liner do? As always, you can check &amp;lt;tt&amp;gt;man bpftrace&amp;lt;/tt&amp;gt; if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;(&amp;lt;b&amp;gt;Optional&amp;lt;/b&amp;gt; in the submission but you should do it) It seems the command above does not show useful information as the third argument is actually a pointer. So, to be able to show the two arguments &amp;lt;tt&amp;gt;virt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;phys&amp;lt;/tt&amp;gt; defined in &amp;lt;tt&amp;gt;3000physicalview.h&amp;lt;/tt&amp;gt;, you will need to create a *.bt file.&lt;br /&gt;
Refer to &amp;lt;tt&amp;gt;/usr/sbin/*.bt&amp;lt;/tt&amp;gt; and convert the one-liner above into something like &amp;lt;tt&amp;gt;snoop3000physicalview.bt&amp;lt;/tt&amp;gt;, so that when it runs it prints the &amp;lt;tt&amp;gt;virt&amp;lt;/tt&amp;gt; passed in and the &amp;lt;tt&amp;gt;phys&amp;lt;/tt&amp;gt; that is returned.&lt;br /&gt;
The code will be posted and explained.&lt;br /&gt;
&amp;lt;br&amp;gt; Note: if you choose to directly include the header file you need to create a copy and remove the &amp;lt;tt&amp;gt;MODULE_*&amp;lt;/tt&amp;gt; macros. Otherwise, you can simply include the struct definition.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_7&amp;diff=25029</id>
		<title>COMP3000 Operating Systems W25: Tutorial 7</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_7&amp;diff=25029"/>
		<updated>2025-03-03T03:12:54Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;In this tutorial you&amp;#039;ll be learning about Linux kernel modules, part of which are device drivers. You’ll create several kernel modules and see how to interact with device drivers using special files (e.g., character device) and their file operations as an interface. You can also have a better understanding of special files by doing so.   ==General Instructions (same for all tutorials)==  &amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt; Click on Expand to view. &amp;lt;div class=&amp;quot;mw-...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you&#039;ll be learning about Linux kernel modules, part of which are device drivers. You’ll create several kernel modules and see how to interact with device drivers using special files (e.g., character device) and their file operations as an interface. You can also have a better understanding of special files by doing so. &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Important Tips==&lt;br /&gt;
* There is a chance your VM will crash or your ssh session will become unresponsive when messing with the kernel. To recover, you can reboot your VM from the OpenStack web console.&lt;br /&gt;
* Definitely do not under any circumstances attempt this on your own system. This is your last warning.&lt;br /&gt;
* Remember to recompile and insert your module after making changes.&lt;br /&gt;
* Work incrementally and be prepared for your system to crash.&lt;br /&gt;
* It might be wise to code on your own computer and use &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;sshfs&amp;lt;/tt&amp;gt; to transfer the files to your VM.&lt;br /&gt;
* https://elixir.bootlin.com/linux/latest/source is a great resource for learning about kernel functions and data structures.&lt;br /&gt;
&lt;br /&gt;
Note: although it&#039;s highly recommended that you use the openstack instance, if you cannot for a reason, or if you encounter other issues, check out [[COMP3000 Operating Systems W25: Tutorial 7 Not Using SCS OpenStack | these instructions]] to see if they help.&lt;br /&gt;
&lt;br /&gt;
==Special Files==&lt;br /&gt;
Before you start, review what you have learned about special files and think about the following questions (no need to answer them): 1) What does a special file represent and what backs it up? 2) Can you have multiple special files that are somehow &amp;quot;the same&amp;quot;? What does it mean to &amp;quot;copy&amp;quot; a special file? 3) How are named pipes different from unnamed pipes and what are their similarities? Take this opportunity to deepen your understanding of special files to prepare you for working with device drivers that support such special files.&lt;br /&gt;
&lt;br /&gt;
===Tasks part A: Understanding special files===&lt;br /&gt;
# Try the following commands as a non-privileged user. What does each do? How do the files f1-f3 compare? How do they compare to &amp;lt;tt&amp;gt;/dev/urandom&amp;lt;/tt&amp;gt;? Remember you can get output from &amp;lt;tt&amp;gt;/dev/urandom&amp;lt;/tt&amp;gt; using &amp;lt;tt&amp;gt;cat&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt;. If you use &amp;lt;tt&amp;gt;cat&amp;lt;/tt&amp;gt;, make sure to pipe it to &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt;!&lt;br /&gt;
#* &amp;lt;tt&amp;gt;cp /dev/urandom f1&amp;lt;/tt&amp;gt; 		(hit Ctrl+C right away to avoid a huge file)&lt;br /&gt;
#* &amp;lt;tt&amp;gt;sudo cp -a /dev/urandom f2&amp;lt;/tt&amp;gt;&lt;br /&gt;
#* &amp;lt;tt&amp;gt;sudo mknod f3 c 1 9&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: Note: If you see any command running for more than a few seconds, hit Ctrl+C right away, check the produced file (often it’s very large) and delete it if not needed.&lt;br /&gt;
# Make named pipes using &amp;lt;tt&amp;gt;mknod&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;mkfifo&amp;lt;/tt&amp;gt;. Use them to simulate &amp;lt;tt&amp;gt;ls | wc&amp;lt;/tt&amp;gt; using just the &#039;&amp;gt;&#039; and &#039;&amp;lt;&#039; operators.&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;mknod&amp;lt;/tt&amp;gt; to make a copy of your current terminal&#039;s tty - &amp;lt;tt&amp;gt;/dev/tty&amp;lt;/tt&amp;gt; (Hint: consider how you did something similar with &amp;lt;tt&amp;gt;/dev/urandom&amp;lt;/tt&amp;gt; above). You can name it &amp;lt;tt&amp;gt;mytty&amp;lt;/tt&amp;gt;. Examine its characteristics using &amp;lt;tt&amp;gt;stty --file=mytty&amp;lt;/tt&amp;gt;. Do the same for the original tty. &lt;br /&gt;
# Run &amp;lt;tt&amp;gt;stty --help&amp;lt;/tt&amp;gt; to see what you can do with stty. Try disabling local echo. How does the shell behave with echo disabled? How can you restore echo without logging out and back in? Recall we did this in the class.&lt;br /&gt;
&lt;br /&gt;
==Kernel Modules==&lt;br /&gt;
In this part of the tutorial you will be building and installing kernel modules. You will need root access to install kernel modules.&lt;br /&gt;
&lt;br /&gt;
It is &#039;&#039;&#039;highly recommended&#039;&#039;&#039; that you use a comp3000 openstack instance for the exercises below for two reasons. First, you may have difficulties compiling kernel modules on other systems. Second, these operations are potentially dangerous, and mistakes could &#039;&#039;&#039;destroy all data&#039;&#039;&#039; on the Linux system. Consider yourself warned!&lt;br /&gt;
&lt;br /&gt;
Before you start, review what you have learned about kernel modules and device drivers, and think about the following questions (no need to answer them): 1) How does the source of kernel modules differ from C programs? 2) How does building kernel modules differ from building userspace C programs? 3) How does invoking the file operations (e.g., read/write) of a special file trigger corresponding functions in a device driver?&lt;br /&gt;
&lt;br /&gt;
You will learn how you can access and manipulate kernel data structures and call kernel functions in a kernel module. You will also understand how processes are represented by &amp;lt;tt&amp;gt;task_struct&amp;lt;/tt&amp;gt;&#039;s in the Linux kernel, what kind of information is stored in a task struct, and how to access the &amp;lt;tt&amp;gt;task_struct&amp;lt;/tt&amp;gt; of a process.&lt;br /&gt;
&lt;br /&gt;
===Tasks part B: A simple kernel module===&lt;br /&gt;
Download the source for this [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut7/simple.tar.gz simple module], unpack, and build it by typing &amp;quot;&amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt;&amp;quot;. You can safely ignore the warning of &amp;quot;Skipping BTF generation...&amp;quot; if encountered.&lt;br /&gt;
# Install the module using &amp;quot;&amp;lt;tt&amp;gt;sudo insmod simple.ko&amp;lt;/tt&amp;gt;&amp;quot;. The hello message is recorded in the kernel logs. How do you view the kernel logs? How many ways are there to view them?&lt;br /&gt;
# Check to see that the module has been loaded. How do you do this?&lt;br /&gt;
# Remove the module from the kernel. What did you do?&lt;br /&gt;
&lt;br /&gt;
===Tasks part C: A character device kernel module (driver)===&lt;br /&gt;
Download the source for [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut7/ones.tar.gz ones], a kernel module implementing a character device that outputs an unbounded string of &amp;quot;1&amp;quot;&#039;s. Build, compile, and run it as before.&lt;br /&gt;
# What kernel messages does the module generate? Does it create any new files (other than &amp;lt;tt&amp;gt;/dev/ones&amp;lt;/tt&amp;gt;)? If so, where? (Hint: search in &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# What happens when you &amp;quot;cat&amp;quot; the device &amp;lt;tt&amp;gt;/dev/ones&amp;lt;/tt&amp;gt;? How can you limit the output in more than one way?&lt;br /&gt;
# Add more &amp;lt;tt&amp;gt;printk()&amp;lt;/tt&amp;gt;’s (where you see needed) to find out at which point which functions in ones.c are called and for which purpose.&lt;br /&gt;
&lt;br /&gt;
===Tasks part D: Getting process information from a module===&lt;br /&gt;
Download the source [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut7/newgetpid.tar.gz newgetpid.c]. Build and run it as before. Hints for the questions below: &lt;br /&gt;
&lt;br /&gt;
https://elixir.bootlin.com/linux/latest/source/include/linux/sched.h, &lt;br /&gt;
https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/current.h, &lt;br /&gt;
https://elixir.bootlin.com/linux/latest/source/include/linux/cred.h&lt;br /&gt;
# What type is &amp;quot;&amp;lt;tt&amp;gt;current&amp;lt;/tt&amp;gt;&amp;quot;? &amp;lt;u&amp;gt;How&amp;lt;/u&amp;gt; can you figure this out?&lt;br /&gt;
# Modify newgetpid.c so that it creates a device file &amp;lt;tt&amp;gt;/dev/describe&amp;lt;/tt&amp;gt; rather than &amp;lt;tt&amp;gt;/dev/newgetpid&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Make &amp;lt;tt&amp;gt;/dev/describe&amp;lt;/tt&amp;gt; output the calling process&#039;s parent ID (ppid), user ID (uid), group ID (gid), effective user ID (euid), and effective group ID (egid).&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt; to monitor kernel module events==&lt;br /&gt;
Note: you are not required to write about your experience for this part in the submitted work, but you should still do it, which can help you understand eBPF better (see how simple but still powerful an eBPF program can be).&lt;br /&gt;
&lt;br /&gt;
Download this tiny code [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut7/kmsnoop.bt kmsnoop.bt] and make it executable with &amp;lt;tt&amp;gt;chmod 755 kmsnoop.bt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now, you can open a separate SSH session and run it with &amp;lt;tt&amp;gt;sudo ./kmsnoop.bt&amp;lt;/tt&amp;gt;. It will wait for events. When you do any &amp;quot;insmod&amp;quot; or &amp;quot;rmmod&amp;quot; in the other session, you will see it outputs a line of message.&lt;br /&gt;
&lt;br /&gt;
If you want to avoid opening another SSH window, you can use &amp;lt;tt&amp;gt;tmux&amp;lt;/tt&amp;gt; (which we learned in Tutorial 1).&lt;br /&gt;
&lt;br /&gt;
How could this save you from doing any &amp;lt;tt&amp;gt;printk&amp;lt;/tt&amp;gt;&#039;s in your kernel module code?&lt;br /&gt;
You can also &amp;lt;tt&amp;gt;sudo bpftrace -l | grep&amp;lt;/tt&amp;gt; for your needed kernel functions (e.g.,&amp;lt;tt&amp;gt;printk&amp;lt;/tt&amp;gt;) to hook to.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_7_Not_Using_SCS_OpenStack&amp;diff=25028</id>
		<title>COMP3000 Operating Systems W25: Tutorial 7 Not Using SCS OpenStack</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_7_Not_Using_SCS_OpenStack&amp;diff=25028"/>
		<updated>2025-03-03T02:34:41Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;If you are not using our course VM for some reason, you might encounter problems and you can refer to the instructions below. Although they are by no means comprehensive to solve the problems, they can in many cases and serve as pointers about where to look.  ==Modules fail to build== If you see errors (not just warnings) after running &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; and no &amp;lt;tt&amp;gt;.ko&amp;lt;/tt&amp;gt; file is produced, you may have installed a version of Ubuntu that is too minimal. But you can fix it by...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you are not using our course VM for some reason, you might encounter problems and you can refer to the instructions below. Although they are by no means comprehensive to solve the problems, they can in many cases and serve as pointers about where to look.&lt;br /&gt;
&lt;br /&gt;
==Modules fail to build==&lt;br /&gt;
If you see errors (not just warnings) after running &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; and no &amp;lt;tt&amp;gt;.ko&amp;lt;/tt&amp;gt; file is produced, you may have installed a version of Ubuntu that is too minimal. But you can fix it by installing the right packages. Do the following:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
&lt;br /&gt;
 sudo apt dist-upgrade&lt;br /&gt;
 &lt;br /&gt;
 sudo apt install build-essential&lt;br /&gt;
 &lt;br /&gt;
 sudo apt clean&lt;br /&gt;
&lt;br /&gt;
If your build failed before doing this and again after, delete the downloaded code and unpack the zip file again.&lt;br /&gt;
&lt;br /&gt;
==Disk full==&lt;br /&gt;
If you find your disk space filled up, you can use the following command to pinpoint the top 20 largest files (no need to understand the specifics unless you are curious):&lt;br /&gt;
&lt;br /&gt;
 sudo find / -type f -exec du -h {} 2&amp;gt;&amp;amp;- + | sort -rh | head -20&lt;br /&gt;
&lt;br /&gt;
Or including directories:&lt;br /&gt;
&lt;br /&gt;
 sudo du -h / 2&amp;gt;&amp;amp;- | sort -rh | head -20&lt;br /&gt;
&lt;br /&gt;
==Command &#039;bpftrace&#039; not found==&lt;br /&gt;
You may be able to fix this by installing the &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt; package (just the frontend and the examples):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install bpftrace&lt;br /&gt;
&lt;br /&gt;
Use its equivalent on other Linux distributions.&lt;br /&gt;
&lt;br /&gt;
Note: it could be much worse than this, e.g., not having the right kernel compiled with eBPF support, for which there won&#039;t be a quick fix.&lt;br /&gt;
In such cases, you are suggested to move to the course VM or choose a different VM of your own.&lt;br /&gt;
&lt;br /&gt;
If you see an error like &amp;quot;&amp;lt;tt&amp;gt;Could not resolve symbol&amp;lt;/tt&amp;gt;&amp;quot; when using &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt;, you need to apply a fix by installing the dbgsym package of &amp;lt;tt&amp;gt;bpftrace&amp;lt;/tt&amp;gt;: Just &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut7/install-bpftrace-dbgsym this file], and run it with&lt;br /&gt;
&lt;br /&gt;
  sudo apt update&lt;br /&gt;
  source install-bpftrace-dbgsym&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_6&amp;diff=25010</id>
		<title>COMP3000 Operating Systems W25: Tutorial 6</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_6&amp;diff=25010"/>
		<updated>2025-02-21T03:25:54Z</updated>

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

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;In this tutorial you will be learning about files and filesystems by experimenting with and extending [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut5/3000test.c 3000test.c], and creating and manipulating local filesystems. &amp;#039;&amp;#039;&amp;#039;WARNING:&amp;#039;&amp;#039;&amp;#039; Several of the commands here can lead to system corruption and data loss if not properly used. You have been warned. Please use a VM and make backups, when necessary.  ==General Instructions (same for all tutorials)==  &amp;lt;d...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will be learning about files and filesystems by experimenting with and extending [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut5/3000test.c 3000test.c], and creating and manipulating local filesystems. &#039;&#039;&#039;WARNING:&#039;&#039;&#039; Several of the commands here can lead to system corruption and data loss if not properly used. You have been warned. Please use a VM and make backups, when necessary.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files and inodes==&lt;br /&gt;
In UNIX/Linux filesystems, a filename does not directly refer to the contents of a file. Instead, a filename refers to an inode (as specified in a directory entry --- dentry, of its parent directory), and the inode then refers to the data. An inode is where file metadata is stored. File ownership, timestamps, and permissions are all stored in a file&#039;s inode. Files listed by the &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command are just &#039;&#039;&#039;hard links&#039;&#039;&#039; connecting a file name to an inode. &lt;br /&gt;
&lt;br /&gt;
In addition to regular files, we also have symbolic links, directories, block devices, character devices, and pipes. Each is its own type of inode.&lt;br /&gt;
&lt;br /&gt;
Note that while you can find out a file&#039;s inode, you cannot go from an inode to a pathname or otherwise manipulate an inode directly from userspace - you always have to go through the pathname. The kernel, however, can access individual inodes directly (indeed it has to in order to get to the contents of a file when given a filename).&lt;br /&gt;
&lt;br /&gt;
3000test.c uses &amp;lt;tt&amp;gt;stat()&amp;lt;/tt&amp;gt; to give information on a given inode.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions (Part A)==&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut5/3000test.c 3000test.c]. It takes a filename as an argument and reports information on the file. Try giving it the following and see what it reports:&lt;br /&gt;
#* a regular text file that exists&lt;br /&gt;
#* a directory&lt;br /&gt;
#* a symbolic link&lt;br /&gt;
#* a device file (character or block)&lt;br /&gt;
# Change 3000test to use &amp;lt;tt&amp;gt;lstat()&amp;lt;/tt&amp;gt; rather than stat. How does its behavior change?&lt;br /&gt;
# Modify 3000test so when it is given a symbolic link it reports the name of the target. Use &amp;lt;tt&amp;gt;readlink(2)&amp;lt;/tt&amp;gt; (this notation describes how to access the man page, e.g., &amp;lt;tt&amp;gt;man 2 readlink&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Are there files or directories that you cannot run 3000test on? Can you configure file/directory permissions so as to make something inaccessible to 3000test? Note that this is twofold: 1) whether it is completely inaccessible to 3000test (&#039;&#039;&#039;nothing can be displayed&#039;&#039;&#039;, except the error msg); 2) whether it can be accessed for the search (&#039;&#039;&#039;no access to file content&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
==Creating, Mounting, and Unmounting Filesystem==&lt;br /&gt;
In UNIX/Linux systems we always have a single hierarchical namespace for files and directories. Pathnames that start with a &amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt; are absolute, starting at the top of the namespace, while ones that do not start with a / are relative to the current directory.&lt;br /&gt;
&lt;br /&gt;
The files in this single namespace come from many sources, each of which can have very different semantics. These sources are known as &#039;&#039;&#039;filesystems&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When first started, a system must have at least one filesystem. This first filesystem is known as the root filesystem and has the contents of &amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt;. We can then add other filesystems to this initial set of files by &#039;&#039;&#039;mounting&#039;&#039;&#039; each filesystem on an existing directory.&lt;br /&gt;
&lt;br /&gt;
On our current Ubuntu, the root filesystem is ext4 by default and many others are mounted on top of it. For example, a proc filesystem is mounted on &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, a sysfs is mounted on &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;. If you run &amp;quot;mount&amp;quot; with no arguments, it lists all the currently mounted filesystems. Note that most of these are special (aka. virtual) filesystems, in that they do not correspond to any persistent storage (like a disk).&lt;br /&gt;
&lt;br /&gt;
If you insert a USB stick on a laptop or desktop running Linux, it must be mounted before you can access its contents. The current convention is for it to be mounted in &amp;lt;tt&amp;gt;/media/&amp;lt;/tt&amp;gt;&amp;lt;mounting user&amp;gt;&amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt;&amp;lt;name of USB stick filesystem&amp;gt;. This usually happens automatically nowadays when the USB stick is plugged in.&lt;br /&gt;
&lt;br /&gt;
To create an ext4 filesystem, you just run&lt;br /&gt;
&lt;br /&gt;
 mkfs.ext4 &amp;lt;writable block device&amp;gt;  &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;#Do not try it with any &amp;lt;tt&amp;gt;/dev/*&amp;lt;/tt&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you were to run this on the root filesystem of your current system, it would reformat your entire disk if it was allowed to complete. In all likelihood the system should prevent you from doing this as the root filesystem (and any mounted filesystem) gets special protections.&lt;br /&gt;
&lt;br /&gt;
To mount a filesystem, you specify the filesystem to be mounted (by its type or by the device) and the mountpoint:&lt;br /&gt;
&lt;br /&gt;
 mount /dev/sdb1 /mnt  &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;#Do not try it unless you have that block device and want to do it&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would mount the first partition of the second disk on &amp;lt;tt&amp;gt;/mnt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Filesystems can be stored on block devices - devices whose contents are accessed by specifying a block index/address. The other main type of device file, character devices, are used for devices where the data is accessed a single byte (character) at a time. Terminals, modems, printers – for example, will generally be represented as a character device.&lt;br /&gt;
&lt;br /&gt;
Note that mount here can identify the filesystem on &amp;lt;tt&amp;gt;/dev/sdb1&amp;lt;/tt&amp;gt; by looking at its superblock. The superblock is usually either in block 0 or 1 of a device. The superblock holds metadata of a filesystem, allowing it to be identified and specified. Without the superblock you cannot do anything with a filesystem. Because of its importance, there are backup superblocks in addition to the primary one. The blocks of a filesystem can be classified as either being superblocks, inode blocks, or data blocks.&lt;br /&gt;
&lt;br /&gt;
Sometimes we want to play with a new filesystem but we don&#039;t have a physical device to format. If we have free space for a file in our current filesystem, however, we can put a filesystem in a file by using a loopback block device. A loopback block device is a block device where its data is stored in a regular file on another filesystem (rather than on a separate device). If you do filesystem commands with a regular file, it will transparently associate the file with an available loopback block device (e.g., &amp;lt;tt&amp;gt;/dev/loop1&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Note that inode numbers are filesystem-specific. Thus, the contents of a file are uniquely specified by its filesystem and inode. Only the kernel has to worry about this level of detail; in userspace, a file&#039;s full path contains all the necessary information.&lt;br /&gt;
&lt;br /&gt;
Filesystems on persistent storage are always at risk of corruption. File system checker programs (&amp;lt;tt&amp;gt;fsck&amp;lt;/tt&amp;gt;) can detect and repair filesystem errors.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions (Part B)==&lt;br /&gt;
# Run &amp;lt;tt&amp;gt;dd if=/dev/zero of=foo bs=8192 count=32K&amp;lt;/tt&amp;gt; and use the &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; command to check it. What is the logical size of the file foo? How much space does it consume on disk? (Hint: Look at the size option to ls). In comparison, create another file with &amp;lt;tt&amp;gt;dd if=/dev/zero of=foo2 bs=8192 seek=31K count=1K&amp;lt;/tt&amp;gt;. Any observations?&lt;br /&gt;
# Run &amp;lt;tt&amp;gt;mkfs.ext4 foo&amp;lt;/tt&amp;gt;. Does foo consume any more space or less? Do the same (&amp;lt;tt&amp;gt;mkfs.ext4 foo2&amp;lt;/tt&amp;gt;) to the other file and answer the same question.&lt;br /&gt;
# Create any file in &amp;lt;tt&amp;gt;/mnt&amp;lt;/tt&amp;gt; (e.g., &amp;lt;tt&amp;gt;sudo touch test.txt&amp;lt;/tt&amp;gt;) and run &amp;lt;tt&amp;gt;sudo mount foo /mnt&amp;lt;/tt&amp;gt;. Do you still see the file you just created?&lt;br /&gt;
# Run &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt;. What device is mounted on &amp;lt;tt&amp;gt;/mnt&amp;lt;/tt&amp;gt;? What is this device? &lt;br /&gt;
# Run &amp;lt;tt&amp;gt;sudo umount /mnt&amp;lt;/tt&amp;gt;. What have gone away and what is back?&lt;br /&gt;
# Run &amp;lt;tt&amp;gt;dd if=/dev/zero of=foo conv=notrunc count=10 bs=512&amp;lt;/tt&amp;gt;. How does the &amp;quot;&amp;lt;tt&amp;gt;conv=notrunc&amp;lt;/tt&amp;gt;&amp;quot; change dd&#039;s behavior (versus the command in question 1)?&lt;br /&gt;
# Run &amp;lt;tt&amp;gt;sudo mount foo /mnt&amp;lt;/tt&amp;gt;. What error do you get?&lt;br /&gt;
# What command can you run to make foo mountable again? What characteristic of the file system enables this command to work? (Hint: revisit the instructions of this tutorial if you have no idea)&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_4&amp;diff=24982</id>
		<title>COMP3000 Operating Systems W25: Tutorial 4</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_4&amp;diff=24982"/>
		<updated>2025-01-24T05:23:58Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Tasks/Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial, you will learn about how user accounts are managed and how the login process works through exploring [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin.c]. You’ll also have a better understanding of the permission system and the shell/terminal environment.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Linux system==&lt;br /&gt;
As mentioned in class, in order to log in to a Linux-like system (including UNIX), the following steps must occur (potentially not in this order).&lt;br /&gt;
# The user must use a terminal to connect to the system, locally or remotely (e.g., initiated by &amp;lt;tt&amp;gt;/usr/sbin/getty&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# The user must authenticate themselves, proving an identify with authorized access to the system. By default, this is done through a username and password (e.g., by exec’ing &amp;lt;tt&amp;gt;/usr/bin/login&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# After authentication, login changes uid and gid to that of the new user.&lt;br /&gt;
# Login sets up other aspects of the user&#039;s context (mainly setting key environment variables).&lt;br /&gt;
# Login does an exec of the user&#039;s chosen/default shell.&lt;br /&gt;
&lt;br /&gt;
[https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin] is a basic implementation of steps 3-5. (Steps 1 and 2 are accomplished by running 3000userlogin in a shell, as running an external command means the shell also creates a new process for it, assuming an authenticated session with a terminal.)&lt;br /&gt;
&lt;br /&gt;
When 3000userlogin is properly compiled and set up, you can run:&lt;br /&gt;
&lt;br /&gt;
 ./3000userlogin student&lt;br /&gt;
&lt;br /&gt;
and you&#039;ll be logged in (again) as &amp;quot;student&amp;quot;. This only works when you’re already logged in as student (see below).&lt;br /&gt;
&lt;br /&gt;
You can add a user with the &amp;lt;tt&amp;gt;adduser&amp;lt;/tt&amp;gt; command. For example, to create the user &amp;quot;someuser&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 sudo adduser someuser&lt;br /&gt;
&lt;br /&gt;
Note you&#039;ll have to answer several questions. Then you need to switch to someuser (&amp;lt;tt&amp;gt;su someuser&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you just compile 3000userlogin normally, you won&#039;t be able to log in as anyone except the current user (be it student or someuser). To set up 3000userlogin properly, do the following:&lt;br /&gt;
&lt;br /&gt;
 sudo chown root:root 3000userlogin&lt;br /&gt;
 sudo chmod u+s 3000userlogin&lt;br /&gt;
&lt;br /&gt;
Feel free to read the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; pages for both commands to learn more.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; command makes the binary owned by root, and the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command makes it setuid. Thus, when the program is exec&#039;d it will have an effective user ID of root (euid=0). To facilitate the following tasks, you may also want to create different versions of 3000userlogin by naming them, e.g., 3000userlogin.setuid and 3000userlogin.orig, of your choice.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# Compile and setup [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin] as described above. Create a new user account. Verify that you can use 3000userlogin to login as the new user without typing the password of the new user (without logging in beforehand). Think about &amp;lt;u&amp;gt;why&amp;lt;/u&amp;gt; you are able to avoid typing the password and still get authenticated.&lt;br /&gt;
# &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is the syntax highlighting gone (coloring characters)? What simple change (one line) can you make to have 3000userlogin preserve the colors? (Hint: check the environment variables)&lt;br /&gt;
# What is returned as the user&#039;s password by &amp;lt;tt&amp;gt;getpwnam()&amp;lt;/tt&amp;gt; (in terms of data type)? Is this what you expected? Read the manual page as you find necessary.&lt;br /&gt;
#: Which file is accessed during this process? &amp;lt;u&amp;gt;How can you find it out&amp;lt;/u&amp;gt;? (if you end up looking at another file accessed, it is also worth the time.)&lt;br /&gt;
# Compare the uid, gid, euid, egid when running 3000userlogin as a regular user (this means without the “chown” and “chmod” commands above), running it setuid root, and running it as root (i.e., running it from a root shell without the setuid bit set, e.g., “&amp;lt;tt&amp;gt;sudo ./3000userlogin someuser&amp;lt;/tt&amp;gt;”). Also check to see what happens when you set the setgid bit.&lt;br /&gt;
# &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; does 3000userlogin change its gid before changing its uid? &amp;lt;u&amp;gt;What happens&amp;lt;/u&amp;gt; if you switch the order of these operations?&lt;br /&gt;
# You may have noticed that there are multiple mentions of &amp;quot;bash&amp;quot; (on different lines if you search). What are their purposes, respectively?&lt;br /&gt;
# Make 3000userlogin use the shell that is specified in the user&#039;s password entry (which is actually read from &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt;). Check by setting someuser’s shell to a new shell and then see if that new shell runs when you run 3000userlogin. You can change a user&#039;s shell with the &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
# Can you set 3000shell to be a user&#039;s default shell? What changes do you have to make for &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; to accept 3000shell? Does anything obvious break when running 3000shell this way, and how can you change 3000userlogin to fix it?&lt;br /&gt;
# Does a user&#039;s default shell have to be a regular shell? Could it instead be an arbitrary program? &amp;lt;u&amp;gt;How do you know&amp;lt;/u&amp;gt;?&lt;br /&gt;
#: &amp;lt;b&amp;gt;CAUTION:&amp;lt;/b&amp;gt; do not try with the user student (or if you choose to give it a try, you must change it back before logging out or you could be locked out having to turn to IT staff or the instructor for help). The best way is to play with the default shell of someuser.&lt;br /&gt;
# Are the environment variables set by 3000userlogin the only environment variables that are set (visible) after you successfully login? &amp;lt;u&amp;gt;How do you know&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Further to Task 3 above, if the returned data is not what you expected, which other function (very similar to &amp;lt;tt&amp;gt;getpwnam()&amp;lt;/tt&amp;gt;) can you use, so that you will be able to actually check the user&#039;s password?&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_4&amp;diff=24981</id>
		<title>COMP3000 Operating Systems W25: Tutorial 4</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_4&amp;diff=24981"/>
		<updated>2025-01-24T05:23:30Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Tasks/Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial, you will learn about how user accounts are managed and how the login process works through exploring [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin.c]. You’ll also have a better understanding of the permission system and the shell/terminal environment.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Linux system==&lt;br /&gt;
As mentioned in class, in order to log in to a Linux-like system (including UNIX), the following steps must occur (potentially not in this order).&lt;br /&gt;
# The user must use a terminal to connect to the system, locally or remotely (e.g., initiated by &amp;lt;tt&amp;gt;/usr/sbin/getty&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# The user must authenticate themselves, proving an identify with authorized access to the system. By default, this is done through a username and password (e.g., by exec’ing &amp;lt;tt&amp;gt;/usr/bin/login&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# After authentication, login changes uid and gid to that of the new user.&lt;br /&gt;
# Login sets up other aspects of the user&#039;s context (mainly setting key environment variables).&lt;br /&gt;
# Login does an exec of the user&#039;s chosen/default shell.&lt;br /&gt;
&lt;br /&gt;
[https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin] is a basic implementation of steps 3-5. (Steps 1 and 2 are accomplished by running 3000userlogin in a shell, as running an external command means the shell also creates a new process for it, assuming an authenticated session with a terminal.)&lt;br /&gt;
&lt;br /&gt;
When 3000userlogin is properly compiled and set up, you can run:&lt;br /&gt;
&lt;br /&gt;
 ./3000userlogin student&lt;br /&gt;
&lt;br /&gt;
and you&#039;ll be logged in (again) as &amp;quot;student&amp;quot;. This only works when you’re already logged in as student (see below).&lt;br /&gt;
&lt;br /&gt;
You can add a user with the &amp;lt;tt&amp;gt;adduser&amp;lt;/tt&amp;gt; command. For example, to create the user &amp;quot;someuser&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 sudo adduser someuser&lt;br /&gt;
&lt;br /&gt;
Note you&#039;ll have to answer several questions. Then you need to switch to someuser (&amp;lt;tt&amp;gt;su someuser&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you just compile 3000userlogin normally, you won&#039;t be able to log in as anyone except the current user (be it student or someuser). To set up 3000userlogin properly, do the following:&lt;br /&gt;
&lt;br /&gt;
 sudo chown root:root 3000userlogin&lt;br /&gt;
 sudo chmod u+s 3000userlogin&lt;br /&gt;
&lt;br /&gt;
Feel free to read the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; pages for both commands to learn more.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; command makes the binary owned by root, and the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command makes it setuid. Thus, when the program is exec&#039;d it will have an effective user ID of root (euid=0). To facilitate the following tasks, you may also want to create different versions of 3000userlogin by naming them, e.g., 3000userlogin.setuid and 3000userlogin.orig, of your choice.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# Compile and setup [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin] as described above. Create a new user account. Verify that you can use 3000userlogin to login as the new user without typing the password of the new user (without logging in beforehand). Think about &amp;lt;u&amp;gt;why&amp;lt;/u&amp;gt; you are able to avoid typing the password and still get authenticated.&lt;br /&gt;
# &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is the syntax highlighting gone (coloring characters)? What simple change (one line) can you make to have 3000userlogin preserve the colors? (Hint: check the environment variables)&lt;br /&gt;
# What is returned as the user&#039;s password by &amp;lt;tt&amp;gt;getpwnam()&amp;lt;/tt&amp;gt; (in terms of data type)? Is this what you expected? Read the manual page as you find necessary.&lt;br /&gt;
#: Which file is accessed during this process? &amp;lt;u&amp;gt;How can you find it out&amp;lt;/u&amp;gt;? (if you end up looking at another file accessed, it is also worth the time.)&lt;br /&gt;
# Compare the uid, gid, euid, egid when running 3000userlogin as a regular user (this means without the “chown” and “chmod” commands above), running it setuid root, and running it as root (i.e., running it from a root shell without the setuid bit set, e.g., “&amp;lt;tt&amp;gt;sudo ./3000userlogin someuser&amp;lt;/tt&amp;gt;”). Also check to see what happens when you set the setgid bit.&lt;br /&gt;
# &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; does 3000userlogin change its gid before changing its uid? &amp;lt;u&amp;gt;What happens&amp;lt;/u&amp;gt; if you switch the order of these operations?&lt;br /&gt;
# You may have noticed that there are multiple mentions of &amp;quot;bash&amp;quot; (on different lines if you search). What are their purposes, respectively?&lt;br /&gt;
# Make 3000userlogin use the shell that is specified in the user&#039;s password entry (which is actually read from &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt;). Check by setting someuser’s shell to a new shell and then see if that new shell runs when you run 3000userlogin. You can change a user&#039;s shell with the &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
# Can you set 3000shell to be a user&#039;s default shell? What changes do you have to make for &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; to accept 3000shell? Does anything obvious break when running 3000shell this way, and how can you change 3000userlogin to fix it?&lt;br /&gt;
# Does a user&#039;s default shell have to be a regular shell? Could it instead be an arbitrary program? &amp;lt;u&amp;gt;How do you know&amp;lt;/u&amp;gt;?&lt;br /&gt;
 &amp;lt;b&amp;gt;CAUTION:&amp;lt;/b&amp;gt; do not try with the user student (or if you choose to give it a try, you must change it back before logging out or you could be locked out having to turn to IT staff or the instructor for help). The best way is to play with the default shell of someuser.&lt;br /&gt;
# Are the environment variables set by 3000userlogin the only environment variables that are set (visible) after you successfully login? &amp;lt;u&amp;gt;How do you know&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Further to Task 3 above, if the returned data is not what you expected, which other function (very similar to &amp;lt;tt&amp;gt;getpwnam()&amp;lt;/tt&amp;gt;) can you use, so that you will be able to actually check the user&#039;s password?&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_4&amp;diff=24980</id>
		<title>COMP3000 Operating Systems W25: Tutorial 4</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_4&amp;diff=24980"/>
		<updated>2025-01-24T05:22:31Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;In this tutorial, you will learn about how user accounts are managed and how the login process works through exploring [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin.c]. You’ll also have a better understanding of the permission system and the shell/terminal environment.  ==General Instructions (same for all tutorials)==  &amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt; Click on Expand to view. &amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial, you will learn about how user accounts are managed and how the login process works through exploring [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin.c]. You’ll also have a better understanding of the permission system and the shell/terminal environment.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Logging in to a Linux system==&lt;br /&gt;
As mentioned in class, in order to log in to a Linux-like system (including UNIX), the following steps must occur (potentially not in this order).&lt;br /&gt;
# The user must use a terminal to connect to the system, locally or remotely (e.g., initiated by &amp;lt;tt&amp;gt;/usr/sbin/getty&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# The user must authenticate themselves, proving an identify with authorized access to the system. By default, this is done through a username and password (e.g., by exec’ing &amp;lt;tt&amp;gt;/usr/bin/login&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# After authentication, login changes uid and gid to that of the new user.&lt;br /&gt;
# Login sets up other aspects of the user&#039;s context (mainly setting key environment variables).&lt;br /&gt;
# Login does an exec of the user&#039;s chosen/default shell.&lt;br /&gt;
&lt;br /&gt;
[https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin] is a basic implementation of steps 3-5. (Steps 1 and 2 are accomplished by running 3000userlogin in a shell, as running an external command means the shell also creates a new process for it, assuming an authenticated session with a terminal.)&lt;br /&gt;
&lt;br /&gt;
When 3000userlogin is properly compiled and set up, you can run:&lt;br /&gt;
&lt;br /&gt;
 ./3000userlogin student&lt;br /&gt;
&lt;br /&gt;
and you&#039;ll be logged in (again) as &amp;quot;student&amp;quot;. This only works when you’re already logged in as student (see below).&lt;br /&gt;
&lt;br /&gt;
You can add a user with the &amp;lt;tt&amp;gt;adduser&amp;lt;/tt&amp;gt; command. For example, to create the user &amp;quot;someuser&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 sudo adduser someuser&lt;br /&gt;
&lt;br /&gt;
Note you&#039;ll have to answer several questions. Then you need to switch to someuser (&amp;lt;tt&amp;gt;su someuser&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
If you just compile 3000userlogin normally, you won&#039;t be able to log in as anyone except the current user (be it student or someuser). To set up 3000userlogin properly, do the following:&lt;br /&gt;
&lt;br /&gt;
 sudo chown root:root 3000userlogin&lt;br /&gt;
 sudo chmod u+s 3000userlogin&lt;br /&gt;
&lt;br /&gt;
Feel free to read the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; pages for both commands to learn more.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;chown&amp;lt;/tt&amp;gt; command makes the binary owned by root, and the &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; command makes it setuid. Thus, when the program is exec&#039;d it will have an effective user ID of root (euid=0). To facilitate the following tasks, you may also want to create different versions of 3000userlogin by naming them, e.g., 3000userlogin.setuid and 3000userlogin.orig, of your choice.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# Compile and setup [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut4/3000userlogin.c 3000userlogin] as described above. Create a new user account. Verify that you can use 3000userlogin to login as the new user without typing the password of the new user (without logging in beforehand). Think about &amp;lt;u&amp;gt;why&amp;lt;/u&amp;gt; you are able to avoid typing the password and still get authenticated.&lt;br /&gt;
# &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; is the syntax highlighting gone (coloring characters)? What simple change (one line) can you make to have 3000userlogin preserve the colors? (Hint: check the environment variables)&lt;br /&gt;
# What is returned as the user&#039;s password by &amp;lt;tt&amp;gt;getpwnam()&amp;lt;/tt&amp;gt; (in terms of data type)? Is this what you expected? Read the manual page as you find necessary.&lt;br /&gt;
#: Which file is accessed during this process? &amp;lt;u&amp;gt;How can you find it out&amp;lt;/u&amp;gt;? (if you end up looking at another file accessed, it is also worth the time.)&lt;br /&gt;
# Compare the uid, gid, euid, egid when running 3000userlogin as a regular user (this means without the “chown” and “chmod” commands above), running it setuid root, and running it as root (i.e., running it from a root shell without the setuid bit set, e.g., “&amp;lt;tt&amp;gt;sudo ./3000userlogin someuser&amp;lt;/tt&amp;gt;”). Also check to see what happens when you set the setgid bit.&lt;br /&gt;
# &amp;lt;u&amp;gt;Why&amp;lt;/u&amp;gt; does 3000userlogin change its gid before changing its uid? &amp;lt;u&amp;gt;What happens&amp;lt;/u&amp;gt; if you switch the order of these operations?&lt;br /&gt;
# You may have noticed that there are multiple mentions of &amp;quot;bash&amp;quot; (on different lines if you search). What are their purposes, respectively?&lt;br /&gt;
# Make 3000userlogin use the shell that is specified in the user&#039;s password entry (which is actually read from &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt;). Check by setting someuser’s shell to a new shell and then see if that new shell runs when you run 3000userlogin. You can change a user&#039;s shell with the &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
# Can you set 3000shell to be a user&#039;s default shell? What changes do you have to make for &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; to accept 3000shell? Does anything obvious break when running 3000shell this way, and how can you change 3000userlogin to fix it?&lt;br /&gt;
# Does a user&#039;s default shell have to be a regular shell? Could it instead be an arbitrary program? &amp;lt;u&amp;gt;How do you know&amp;lt;/u&amp;gt;?&lt;br /&gt;
&amp;lt;b&amp;gt;CAUTION:&amp;lt;/b&amp;gt; do not try with the user student (or if you choose to give it a try, you must change it back before logging out or you could be locked out having to turn to IT staff or the instructor for help). The best way is to plat with the default shell of someuser.&lt;br /&gt;
# Are the environment variables set by 3000userlogin the only environment variables that are set (visible) after you successfully login? &amp;lt;u&amp;gt;How do you know&amp;lt;/u&amp;gt;?&lt;br /&gt;
# Further to Task 3 above, if the returned data is not what you expected, which other function (very similar to &amp;lt;tt&amp;gt;getpwnam()&amp;lt;/tt&amp;gt;) can you use, so that you will be able to actually check the user&#039;s password?&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_3&amp;diff=24972</id>
		<title>COMP3000 Operating Systems W25: Tutorial 3</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_3&amp;diff=24972"/>
		<updated>2025-01-18T06:36:22Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;In this tutorial, you will be experimenting with and extending [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut3/3000shell.c 3000shell.c], a proof-of-concept program to show you how a Linux shell works. Also, 3000shell&amp;#039;s source code will be used as the basis for further modifications in upcoming assignments.  ==General Instructions (same for all tutorials)==  &amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt; Click on Expand to view. &amp;lt;div class=&amp;quot;mw-collapsible-conte...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial, you will be experimenting with and extending [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut3/3000shell.c 3000shell.c], a proof-of-concept program to show you how a Linux shell works. Also, 3000shell&#039;s source code will be used as the basis for further modifications in upcoming assignments.&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===Processes===&lt;br /&gt;
Each application running on a system is assigned a unique process identifier (PID). 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.&lt;br /&gt;
&lt;br /&gt;
When you enter a command at a shell prompt, most of the time you are creating a new process which runs the program you specified.&lt;br /&gt;
&lt;br /&gt;
===Controlling Processes===&lt;br /&gt;
On Linux, once the processes have been created, you can control them by sending them signals. From the terminal (e.g., command line), you send signals when you type certain key sequences in most shells: Control-C sends INT (interrupt), Control-Z sends STOP.&lt;br /&gt;
&lt;br /&gt;
You can also send a signal to a process using the kill command:&lt;br /&gt;
&lt;br /&gt;
 kill -&amp;lt;signal&amp;gt; &amp;lt;process ID&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, to stop process 4542, type: &lt;br /&gt;
&lt;br /&gt;
 kill -STOP 4542&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;kill&amp;lt;/tt&amp;gt; sends the &amp;lt;tt&amp;gt;TERM&amp;lt;/tt&amp;gt; signal.&lt;br /&gt;
&lt;br /&gt;
Each signal has both a string name (e.g., &amp;lt;tt&amp;gt;STOP&amp;lt;/tt&amp;gt;) and a numeric form (e.g., 19 correspondingly). See the full list of signals with &amp;lt;tt&amp;gt;kill -l&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Standard input/output, Shell and Terminal===&lt;br /&gt;
Recall that the shell is a command interpreter (program). In comparison, a terminal is a device used to enter data into and display/printing data from a computer. It used to be physical - [https://en.wikipedia.org/wiki/Teleprinter teletypes, or &amp;quot;TTY&amp;quot;&#039;s], but today we mostly use virtual terminals, saving the need for the physical form but providing the same interface (recall virtualization). There is a special virtual terminal mechanism in Linux/UNIX referred to as pts -- pseudo teletypes, e.g., &amp;lt;tt&amp;gt;/dev/pts/1&amp;lt;/tt&amp;gt; (they are just the slave side. Those who are curious can refer to &amp;lt;tt&amp;gt;man ptmx&amp;lt;/tt&amp;gt;, but not needed in this tutorial).&lt;br /&gt;
&lt;br /&gt;
The standard input (e.g., &amp;lt;tt&amp;gt;/dev/stdin&amp;lt;/tt&amp;gt;), output (e.g., &amp;lt;tt&amp;gt;/dev/stdout&amp;lt;/tt&amp;gt;) and error (&amp;lt;tt&amp;gt;/dev/stderr&amp;lt;/tt&amp;gt;) are just symbolic endpoints in any programs (of which the shell is an example), that can be redirected anywhere, where output goes, input comes and error is reported. By default, they refer to file descriptors 0, 1, and 2 for the current process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So, in summary, you connect to a terminal to interact with a computer, by running a shell to receive your commands, which redirects standard in/out/err to the terminal.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you progress in this course, you will gradually find how such stdin/stdout/stderr can be useful, especially when combined with the pipeline/redirection. For instance:&lt;br /&gt;
&lt;br /&gt;
 ls | less        #to paginate long output from ls&lt;br /&gt;
&lt;br /&gt;
 ps -ef | grep 3000shell    #to look for the 3000shell process from the process list&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 -o csimpleshell csimpleshell.c 2&amp;gt;err.txt    #to redirect error messages to a file err.txt&lt;br /&gt;
&lt;br /&gt;
Later in the term if you find your disk space filled up, you can use the following command to pinpoint the top 20 largest files (no need to understand the specifics unless you are curious):&lt;br /&gt;
&lt;br /&gt;
 sudo find / -type f -exec du -h {} 2&amp;gt;&amp;amp;- + | sort -rh | head -20&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
The purpose of the following questions and tasks is to help you understand how 3000shell (a simple implementation of the shell, but still more complex than the previous &amp;lt;tt&amp;gt;csimpleshell&amp;lt;/tt&amp;gt;) works. Eventually, you should have an understanding of every function and every line of the code. If you understand 3000shell, then you understand the basics of all Linux/UNIX shells. Your understanding of the code will be tested later, so use this opportunity to dive deep into the code. &lt;br /&gt;
&lt;br /&gt;
You do not need to submit a separate file for source code changes. Just describe your changes or paste the code snippet (usually a few lines at the most).&lt;br /&gt;
&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut3/3000shell.c 3000shell.c].&lt;br /&gt;
# Compared to [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c csimpleshell] from Tutorial 1, what functionality improvements has 3000shell introduced? List at least two improvements (functional differences). You can mention whether you found them by reading the source code or trying both shells.&lt;br /&gt;
# Pay attention to lines 229-235. How can you run a program in the background? Note: “in the background” means the shell starting a program without waiting for it to finish. So, the shell returns immediately to be ready to accept the next command.&lt;br /&gt;
# Observe the behavior when running different programs in the background. What happens to the input and output of the program? Try this for different types of programs, such as &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;bc&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;nano&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt;, or others of your choice. Write down your observations.&lt;br /&gt;
# You may have trouble interacting with the shell after running programs in the background. How can you recover from such a situation? Note: you can do it in a harsh way for this question. We will see a smarter way next. &lt;br /&gt;
# 3000shell implements a simple form of output redirection (i.e., the standard output mentioned earlier). What syntax should you use to redirect standard output to a file?&lt;br /&gt;
# Make the shell output &amp;quot;Ouch!&amp;quot; when you send it a &amp;lt;tt&amp;gt;SIGUSR1&amp;lt;/tt&amp;gt; signal.&lt;br /&gt;
# If you delete line 324 (&amp;lt;tt&amp;gt;SA_RESTART&amp;lt;/tt&amp;gt;), how does the behavior of 3000shell change?&lt;br /&gt;
# Replace the use of &amp;lt;tt&amp;gt;find_env()&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;getenv()&amp;lt;/tt&amp;gt;. How do their interfaces differ?&lt;br /&gt;
# Make &amp;lt;tt&amp;gt;plist&amp;lt;/tt&amp;gt; output the parent process id for each process, e.g., &amp;quot;5123 ls (5122)&amp;quot;. Pay attention to the &amp;lt;tt&amp;gt;stat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;status&amp;lt;/tt&amp;gt; files in the per-process directories in &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# If the shell gets stuck as a result of running a program in the background, how can you recover elegantly (resuming it) by sending just a signal (which signal)? &amp;lt;u&amp;gt;Why?&amp;lt;/u&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24965</id>
		<title>COMP3000 Operating Systems W25: Downloading files from your Openstack VM</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24965"/>
		<updated>2025-01-16T04:08:01Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;, which has a floating IP address associated. Here, you have a few options depending on your situation (assuming you have the Carleton VPN connected). Choose one that works for you or feel free to use other alternatives.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (with Carleton VPN)==&lt;br /&gt;
Secure file copy uses the same protocol as the secure shell (SSH), similar to the SSH command. &lt;br /&gt;
&lt;br /&gt;
 scp &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part in blue is an example pathname of the file to submit on your VM (make sure it matches your situation) and don&#039;t forget &#039;&#039;&#039;the last part in red, which is the destination directory on your PC&#039;&#039;&#039; (e.g., if could simply be a dot &amp;quot;.&amp;quot; representing your current directory, where you are typing this command).&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. This should work for both Windows and Linux-like systems.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (without Carleton VPN)==&lt;br /&gt;
&lt;br /&gt;
 scp -o &amp;quot;ProxyJump &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
 scp -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will first be promoted for your MC1 password set through the SCS account, then your VM&#039;s password for the student user. Replace &amp;lt;CarletonUserName&amp;gt; with your Carleton username.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; (with Carleton VPN)==&lt;br /&gt;
You can also use the more secure and new command, &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. Likewise, also pay attention to the two locations (in red and blue).&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; (without Carleton VPN)==&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP -e &amp;quot;ssh -A -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24964</id>
		<title>COMP3000 Operating Systems W25: Downloading files from your Openstack VM</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24964"/>
		<updated>2025-01-16T04:06:49Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Using rsync */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;, which has a floating IP address associated. Here, you have a few options depending on your situation (assuming you have the Carleton VPN connected). Choose one that works for you or feel free to use other alternatives.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (with Carleton VPN)==&lt;br /&gt;
Secure file copy uses the same protocol as the secure shell (SSH), similar to the SSH command. &lt;br /&gt;
&lt;br /&gt;
 scp &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part in blue is an example pathname of the file to submit on your VM (make sure it matches your situation) and don&#039;t forget &#039;&#039;&#039;the last part in red, which is the destination directory on your PC&#039;&#039;&#039; (e.g., if could simply be a dot &amp;quot;.&amp;quot; representing your current directory, where you are typing this command).&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. This should work for both Windows and Linux-like systems.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (without Carleton VPN)==&lt;br /&gt;
&lt;br /&gt;
 scp -o &amp;quot;ProxyJump &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
 scp -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will first be promoted for your MC1 password set through the SCS account, then your VM&#039;s password for the student user. Replace &amp;lt;CarletonUserName&amp;gt; with your Carleton username.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; (with Carleton VPN)==&lt;br /&gt;
You can also use the more secure and new command, &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. Likewise, also pay attention to the two locations (in red and blue).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24963</id>
		<title>COMP3000 Operating Systems W25: Downloading files from your Openstack VM</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24963"/>
		<updated>2025-01-16T04:05:49Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Using scp (without Carleton VPN) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;, which has a floating IP address associated. Here, you have a few options depending on your situation (assuming you have the Carleton VPN connected). Choose one that works for you or feel free to use other alternatives.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (with Carleton VPN)==&lt;br /&gt;
Secure file copy uses the same protocol as the secure shell (SSH), similar to the SSH command. &lt;br /&gt;
&lt;br /&gt;
 scp &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part in blue is an example pathname of the file to submit on your VM (make sure it matches your situation) and don&#039;t forget &#039;&#039;&#039;the last part in red, which is the destination directory on your PC&#039;&#039;&#039; (e.g., if could simply be a dot &amp;quot;.&amp;quot; representing your current directory, where you are typing this command).&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. This should work for both Windows and Linux-like systems.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (without Carleton VPN)==&lt;br /&gt;
&lt;br /&gt;
 scp -o &amp;quot;ProxyJump &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
 scp -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will first be promoted for your MC1 password set through the SCS account, then your VM&#039;s password for the student user. Replace &amp;lt;CarletonUserName&amp;gt; with your Carleton username.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt;==&lt;br /&gt;
You can also use the more secure and new command, &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. Likewise, also pay attention to the two locations (in red and blue).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24962</id>
		<title>COMP3000 Operating Systems W25: Downloading files from your Openstack VM</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24962"/>
		<updated>2025-01-16T04:04:47Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;, which has a floating IP address associated. Here, you have a few options depending on your situation (assuming you have the Carleton VPN connected). Choose one that works for you or feel free to use other alternatives.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (with Carleton VPN)==&lt;br /&gt;
Secure file copy uses the same protocol as the secure shell (SSH), similar to the SSH command. &lt;br /&gt;
&lt;br /&gt;
 scp &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part in blue is an example pathname of the file to submit on your VM (make sure it matches your situation) and don&#039;t forget &#039;&#039;&#039;the last part in red, which is the destination directory on your PC&#039;&#039;&#039; (e.g., if could simply be a dot &amp;quot;.&amp;quot; representing your current directory, where you are typing this command).&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. This should work for both Windows and Linux-like systems.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt; (without Carleton VPN)==&lt;br /&gt;
&lt;br /&gt;
 scp -o &amp;quot;ProxyJump &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
 scp -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will first be promoted for your MC1 password set through the SCS account, then your VM&#039;s password for the student user. Replace &amp;lt;CarletonUserName&amp;gt; with your Carleton username. &lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt;==&lt;br /&gt;
You can also use the more secure and new command, &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. Likewise, also pay attention to the two locations (in red and blue).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24961</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24961"/>
		<updated>2025-01-16T03:51:22Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN], if you are not on campus.&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
#;[[File:select-project-w25-400px.jpg]]&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] [[File:select-image-w25-580px.jpg]]&lt;br /&gt;
#; Flavor&lt;br /&gt;
#;[[File:select-flavor-w25-580px.jpg]]&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24960</id>
		<title>COMP3000 Operating Systems 2025W</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24960"/>
		<updated>2025-01-16T03:50:48Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Course Outline and Student Hours==&lt;br /&gt;
Aside from the updated version in Brightspace, you can also find it [https://outline.scs.carleton.ca/media/2025/W/COMP3000AW2025/COMP-3000-A-W-2025.pdf here]. Note that only the Brightspace version will contain contact information of the TAs and student hours.&lt;br /&gt;
&lt;br /&gt;
Follow the schedule to meet a TA in the corresponding room. Alternatively, you may also contact the instructor or TAs by email, on MS Teams or booking an appointment to meet online over Zoom.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extended student hours.&#039;&#039;&#039; Every one or two weeks, a Q&amp;amp;A session will be held online&lt;br /&gt;
with the instructor. This is similar to regular student hours except that multiple students will&lt;br /&gt;
be admitted into the session (like a class), and the focus is on lecture topics, e.g., you can ask&lt;br /&gt;
the instructor to re-explain a concept. For ad hoc technical problems, e.g., how to set up the&lt;br /&gt;
environment for a tutorial, please attend a TA’s student hours. The meeting time varies as intended&lt;br /&gt;
and will be announced below and on Brightspace so that if it does not work for a student, it likely will the next time. Priority will be given to students in Section B (if there are too many participants).&lt;br /&gt;
&lt;br /&gt;
==Tutorial Instructions==&lt;br /&gt;
Attending tutorials is required (there is a 0.5 participation mark each) and you need to submit the work by the deadline indicated on Brightspace (for the other 1.5 marks). What is submitted is not graded for correctness but effort showing your attempts and thinking. &amp;lt;u&amp;gt;To receive full marks, make sure to include in your submission how you arrived at the solution or other thoughts (if you figured it out) or any confusion/attempts or even disagreements (if you failed to)&amp;lt;/u&amp;gt;. After the submission, you should continue to study it if there is still anything you do not understand well, for the assignments and exams.&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Openstack Instructions | Instructions for setting up an Openstack instance]]===&lt;br /&gt;
&lt;br /&gt;
===Various ways of [[COMP3000 Operating Systems W25: Connecting to SCS Openstack | connecting to SCS Openstack]]===&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Downloading files from your Openstack VM | Downloading files from your Openstack VM]]===&lt;br /&gt;
&lt;br /&gt;
===Tutorial 1===&lt;br /&gt;
Jan 9 and Jan 10, 2025: [[COMP3000 Operating Systems W25: Tutorial 1 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 2===&lt;br /&gt;
Jan 16 and Jan 17, 2025: [[COMP3000 Operating Systems W25: Tutorial 2 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 3===&lt;br /&gt;
Jan 23 and Jan 24, 2025: [[COMP3000 Operating Systems W25: Tutorial 3 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 4===&lt;br /&gt;
Jan 30 and Jan 31, 2025: [[COMP3000 Operating Systems W25: Tutorial 4 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 5===&lt;br /&gt;
Feb 6 and Feb 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 5 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 6===&lt;br /&gt;
Feb 27 and Feb 28, 2025: [[COMP3000 Operating Systems W25: Tutorial 6 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 7===&lt;br /&gt;
Mar 6 and Mar 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 7 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 8===&lt;br /&gt;
Mar 13 and Mar 14, 2025: [[COMP3000 Operating Systems W25: Tutorial 8 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 9===&lt;br /&gt;
Mar 20 and Mar 21, 2025: [[COMP3000 Operating Systems W25: Tutorial 9 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
==How to Do Well in This Course==&lt;br /&gt;
The goal here is to establish a &amp;lt;u&amp;gt;conceptual model&amp;lt;/u&amp;gt; to understand how operating systems work to serve applications. It is not a course like math or data structures. &#039;&#039;&#039;To succeed, you need to be more hands-on and focus on figuring out how to find the answers (like learning to fish) instead of the answers alone (like being given a fish)&#039;&#039;&#039;. You can NOT expect to do well only by reading course material. You must work with a real OS, with the course material as guidelines. As you progress, you should be gradually able to imagine how various pieces of the OS fit together to function, which will be very useful in your everyday work/life with computers.&lt;br /&gt;
&lt;br /&gt;
If you are asking a lot of &amp;quot;why&amp;quot;s, you are on the right track. Use all available resources (including the course material) as references, like a dictionary, to help answer your &amp;quot;why&amp;quot;s. For example, when you are asked about some information, based on your knowledge, think: 1) which part of the OS should have this information? 2) is it supposed to be available at the point in question? 3) then how do you retrieve that information? e.g., any tool/command/function call?&lt;br /&gt;
For sure, this would not be possible if you are just getting started, so a bit of confusion at the beginning is normal. As you move on, the conceptual model will become clearer as the basis for your thinking.&lt;br /&gt;
&lt;br /&gt;
Mandatory textbook reading will be posted on Brightspace, and thus not all of the textbook will be covered. The exams and assignments are based on lectures, tutorials and designated textbook chapters.&lt;br /&gt;
&lt;br /&gt;
The mini-quizzes are designed to ensure that you are following along by attending classes or listening to recorded lectures every week. So, they are straightforward, directly from class discussions (unlike the midterm and final exams).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24959</id>
		<title>COMP3000 Operating Systems 2025W</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24959"/>
		<updated>2025-01-16T03:50:10Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Course Outline and Student Hours==&lt;br /&gt;
Aside from the updated version in Brightspace, you can also find it [https://outline.scs.carleton.ca/media/2025/W/COMP3000AW2025/COMP-3000-A-W-2025.pdf here]. Note that only the Brightspace version will contain contact information of the TAs and student hours.&lt;br /&gt;
&lt;br /&gt;
Follow the schedule to meet a TA in the corresponding room. Alternatively, you may also contact the instructor or TAs by email, on MS Teams or booking an appointment to meet online over Zoom.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extended student hours.&#039;&#039;&#039; Every one or two weeks, a Q&amp;amp;A session will be held online&lt;br /&gt;
with the instructor. This is similar to regular student hours except that multiple students will&lt;br /&gt;
be admitted into the session (like a class), and the focus is on lecture topics, e.g., you can ask&lt;br /&gt;
the instructor to re-explain a concept. For ad hoc technical problems, e.g., how to set up the&lt;br /&gt;
environment for a tutorial, please attend a TA’s student hours. The meeting time varies as intended&lt;br /&gt;
and will be announced below and on Brightspace so that if it does not work for a student, it likely will the next time. Priority will be given to students in Section B (if there are too many participants).&lt;br /&gt;
&lt;br /&gt;
==Tutorial Instructions==&lt;br /&gt;
Attending tutorials is required (there is a 0.5 participation mark each) and you need to submit the work by the deadline indicated on Brightspace (for the other 1.5 marks). What is submitted is not graded for correctness but effort showing your attempts and thinking. &amp;lt;u&amp;gt;To receive full marks, make sure to include in your submission how you arrived at the solution or other thoughts (if you figured it out) or any confusion/attempts or even disagreements (if you failed to)&amp;lt;/u&amp;gt;. After the submission, you should continue to study it if there is still anything you do not understand well, for the assignments and exams.&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Openstack Instructions | Instructions for setting up an Openstack instance]]===&lt;br /&gt;
&lt;br /&gt;
Various ways of [[COMP3000 Operating Systems W25: Connecting to SCS Openstack | connecting to SCS Openstack]]===&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Downloading files from your Openstack VM | Downloading files from your Openstack VM]]===&lt;br /&gt;
&lt;br /&gt;
===Tutorial 1===&lt;br /&gt;
Jan 9 and Jan 10, 2025: [[COMP3000 Operating Systems W25: Tutorial 1 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 2===&lt;br /&gt;
Jan 16 and Jan 17, 2025: [[COMP3000 Operating Systems W25: Tutorial 2 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 3===&lt;br /&gt;
Jan 23 and Jan 24, 2025: [[COMP3000 Operating Systems W25: Tutorial 3 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 4===&lt;br /&gt;
Jan 30 and Jan 31, 2025: [[COMP3000 Operating Systems W25: Tutorial 4 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 5===&lt;br /&gt;
Feb 6 and Feb 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 5 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 6===&lt;br /&gt;
Feb 27 and Feb 28, 2025: [[COMP3000 Operating Systems W25: Tutorial 6 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 7===&lt;br /&gt;
Mar 6 and Mar 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 7 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 8===&lt;br /&gt;
Mar 13 and Mar 14, 2025: [[COMP3000 Operating Systems W25: Tutorial 8 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 9===&lt;br /&gt;
Mar 20 and Mar 21, 2025: [[COMP3000 Operating Systems W25: Tutorial 9 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
==How to Do Well in This Course==&lt;br /&gt;
The goal here is to establish a &amp;lt;u&amp;gt;conceptual model&amp;lt;/u&amp;gt; to understand how operating systems work to serve applications. It is not a course like math or data structures. &#039;&#039;&#039;To succeed, you need to be more hands-on and focus on figuring out how to find the answers (like learning to fish) instead of the answers alone (like being given a fish)&#039;&#039;&#039;. You can NOT expect to do well only by reading course material. You must work with a real OS, with the course material as guidelines. As you progress, you should be gradually able to imagine how various pieces of the OS fit together to function, which will be very useful in your everyday work/life with computers.&lt;br /&gt;
&lt;br /&gt;
If you are asking a lot of &amp;quot;why&amp;quot;s, you are on the right track. Use all available resources (including the course material) as references, like a dictionary, to help answer your &amp;quot;why&amp;quot;s. For example, when you are asked about some information, based on your knowledge, think: 1) which part of the OS should have this information? 2) is it supposed to be available at the point in question? 3) then how do you retrieve that information? e.g., any tool/command/function call?&lt;br /&gt;
For sure, this would not be possible if you are just getting started, so a bit of confusion at the beginning is normal. As you move on, the conceptual model will become clearer as the basis for your thinking.&lt;br /&gt;
&lt;br /&gt;
Mandatory textbook reading will be posted on Brightspace, and thus not all of the textbook will be covered. The exams and assignments are based on lectures, tutorials and designated textbook chapters.&lt;br /&gt;
&lt;br /&gt;
The mini-quizzes are designed to ensure that you are following along by attending classes or listening to recorded lectures every week. So, they are straightforward, directly from class discussions (unlike the midterm and final exams).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24956</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24956"/>
		<updated>2025-01-11T04:15:30Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download [https://git.scs.carleton.ca/downloads/CourseVirtualMachines/2024F-2025W/COMP3000-W25.ova &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt;] (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection such as the window and the desktop subsystems, and graphics rendering.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_2&amp;diff=24947</id>
		<title>COMP3000 Operating Systems W25: Tutorial 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_2&amp;diff=24947"/>
		<updated>2025-01-08T23:23:49Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;In this tutorial, you will revisit the lifecyle of a program discussed in class, from source code, to an executable (binary image), and further to loading it into the address space. Then from a different angle, you can see when in execution, how the program (now a process) makes different types of calls to function, and how its memory is laid out. Meanwhile, we can also see how a programmer can make use of existing code (libraries).  ==General Instructions (same for all...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial, you will revisit the lifecyle of a program discussed in class, from source code, to an executable (binary image), and further to loading it into the address space. Then from a different angle, you can see when in execution, how the program (now a process) makes different types of calls to function, and how its memory is laid out. Meanwhile, we can also see how a programmer can make use of existing code (libraries).&lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building Your Program==&lt;br /&gt;
Assuming you use a compiled programming language like C, you will involve the following steps (implicitly) to build your program:&lt;br /&gt;
* Compile source (C) code into assembly code (.s files).&lt;br /&gt;
*:You can see it using &amp;lt;tt&amp;gt;gcc -S -O2 [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c hello.c]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* Assemble assembly code into machine code placed in object code files (.o files).&lt;br /&gt;
*:To avoid the .o file being deleted automatically, you can do the compilation alone without linking by: &amp;lt;tt&amp;gt;gcc -c -O2 hello.c&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* Link object code files together to create a runnable binary image (ELF files, no extension name).&lt;br /&gt;
*:This is the way you did it in Tutorial 1.&lt;br /&gt;
&lt;br /&gt;
==Talking to the OS Kernel via System Calls==&lt;br /&gt;
A process on its own has limited access to the system. It cannot directly access any external devices or data sources (e.g., files, keyboard, the screen, networks) on its own. To access these external resources, to allocate memory, or otherwise change its runtime environment, it must make &#039;&#039;&#039;system calls&#039;&#039;&#039;. So we can say system calls are one way for the contained process to request OS services. Note that system calls run code outside of a process and thus cannot be called like regular function calls. The standard C library provides function wrappers for most commonly-used system calls so they can be accessed like regular C functions. Under the hood, however, these functions make use of special compiler directives in order to generate the machine code necessary to invoke system calls. We will take a closer look later this term.&lt;br /&gt;
&lt;br /&gt;
You can see the system calls produced by a process using the &amp;lt;tt&amp;gt;strace&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this can be a good example to show the orthogonal relationship between root/non-root users and kernel/user modes. System calls are requesting the kernel to do something in the kernel mode on behalf of the calling process. Therefore, any user (even non-root) process making a system call will at certain point run in the kernel mode.&lt;br /&gt;
&lt;br /&gt;
==Static &amp;amp; Dynamic Libraries==&lt;br /&gt;
Because of abstraction (e.g., for portability or ease of development), most applications are not self-contained. For instance, you call just a simple &amp;lt;tt&amp;gt;printf()&amp;lt;/tt&amp;gt; to output a message instead of drawing pixels on a display using a lot of low-level code. Hence, your program relies on lots of external code.&lt;br /&gt;
In compiled languages such as C, external code can be brought into the process through linking. There are two basic types of linking, static and dynamic linking:&lt;br /&gt;
&lt;br /&gt;
* With static linking, code is brought in at compile time (specifically, in the link stage above) and added to the executable. The code is now the same as other application code. (Static libraries are more &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; files like &amp;lt;tt&amp;gt;hello.o&amp;lt;/tt&amp;gt;; in practice, you may see more often &amp;lt;tt&amp;gt;.a&amp;lt;/tt&amp;gt; files, which are &amp;quot;archives&amp;quot; of multiple &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; files.)&lt;br /&gt;
* With dynamic linking, a reference to the library code is added to the binary. The actual library code has to later be loaded when the program is executed. This loading will happen before &amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt; is called (you will notice a lot of noisy system calls at the beginning to achieve this). Then, at runtime, calling functions in such dynamic libraries will take the form of &amp;lt;b&amp;gt;library calls&amp;lt;/b&amp;gt; (which only happens within this process in user space, as opposed to system calls in kernel space).&lt;br /&gt;
&lt;br /&gt;
The dynamic libraries associated with a program binary can be found using the &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt; command. You can use &amp;lt;tt&amp;gt;ltrace&amp;lt;/tt&amp;gt; to see calls to functions that are dynamically linked.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
===Part A===&lt;br /&gt;
Here you will see assembly code, but for now, you do not need to read and understand each line (and it will not be the focus of this course). What you will learn is the ability to extract useful information by skimming the assembly code.&lt;br /&gt;
In general, such assembly code is divided into three colums: starting at position/character 1 will be labels/symbols (which you can refer to), followed by mnemonics (instruction opcodes) and last corresponding arguments (operands).&lt;br /&gt;
If you find it necessary, you can turn to related documentation/manuals like: [https://en.wikibooks.org/wiki/X86_Assembly/GNU_assembly_syntax x86 Assembly/GNU assembly syntax]&lt;br /&gt;
# Looking at the &amp;lt;tt&amp;gt;.s&amp;lt;/tt&amp;gt; file produced from &amp;lt;tt&amp;gt;gcc -S -O2 hello.c&amp;lt;/tt&amp;gt;, do you see anything familiar and discussed in the lectures of our first week?&lt;br /&gt;
# Where (e.g., at which line) is it supposed to call that &amp;lt;tt&amp;gt;printf()&amp;lt;/tt&amp;gt;? If it is not doing that, &amp;lt;tt&amp;gt;why?&amp;lt;/tt&amp;gt; (you can just mention what you think/believe)&lt;br /&gt;
# Generate the .s file for [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut2/syscall-hello.c syscall-hello.c] as well. Observing the two .s files, what do you think is the key difference?&lt;br /&gt;
# You can play around by trying to see: how a function in C is reflected in assembly; how to return from a function; how variables/literals are represented; what are &#039;&#039;&#039;symbols&#039;&#039;&#039; (refer to commands like &amp;lt;tt&amp;gt;nm&amp;lt;/tt&amp;gt;); etc.&lt;br /&gt;
&lt;br /&gt;
===Part B===&lt;br /&gt;
# By default, gcc-produced binaries are dynamically linked (so at runtime they will require dynamic libraries to be present on the system). To compile a binary that is statically linked (so it has no external runtime library dependencies), instead do this:&lt;br /&gt;
#: &amp;lt;tt&amp;gt;gcc -O2 -static hello.c -o hello.static&amp;lt;/tt&amp;gt;&lt;br /&gt;
#: Then compile a dynamically linked version:&lt;br /&gt;
#: &amp;lt;tt&amp;gt;gcc -O2 -z lazy hello.c -o hello.dynamic&amp;lt;/tt&amp;gt;&lt;br /&gt;
#:How does the size of hello.dynamic compare with that of hello.static? &amp;lt;u&amp;gt;Why?&amp;lt;/u&amp;gt;&lt;br /&gt;
# Compile the other flavor of hello.c: [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut2/syscall-hello.c syscall-hello.c]. Build one static version and one dynamic version as well. &lt;br /&gt;
#: Now considering hello.dynamic, hello.static, syscall-hello.dynamic and syscall-hello.static, see what system calls each program produces by running &amp;lt;tt&amp;gt;strace -o sys-somename.log ./somename.static&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;./somename.dynamic&amp;lt;/tt&amp;gt;). Which version generates more system calls? &amp;lt;u&amp;gt;Why?&amp;lt;/u&amp;gt; &lt;br /&gt;
#: Note: system calls are saved in the log file &amp;lt;tt&amp;gt;sys-somename.log&amp;lt;/tt&amp;gt;. Feel free to save them in a different file for each version.&lt;br /&gt;
# See what library calls each program produces by running &amp;lt;tt&amp;gt;ltrace -o lib-somename.log ./somename.dynamic&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;./somename.static&amp;lt;/tt&amp;gt;). Which version generates more library calls? &amp;lt;u&amp;gt;Why?&amp;lt;/u&amp;gt;&lt;br /&gt;
# Remember when building hello in Tutorial 1 you did not use &amp;lt;tt&amp;gt;-z lazy&amp;lt;/tt&amp;gt;. Comparing &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;hello.dynamic&amp;lt;/tt&amp;gt;, any difference? &amp;lt;u&amp;gt;Why this difference?&amp;lt;/u&amp;gt;&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt; to find out what dynamic library dependencies dynamic versions have. What about static versions? &lt;br /&gt;
# You did not need to specify the dynamic library dependencies listed by &amp;lt;tt&amp;gt;ldd&amp;lt;/tt&amp;gt; but the system figured them out. But this is not always the case. Add the following lines of code to hello.c. Now, if you compile it with &amp;lt;tt&amp;gt;gcc -z lazy hello.c -o hello&amp;lt;/tt&amp;gt; (do not use any optimization like &amp;lt;tt&amp;gt;-O2&amp;lt;/tt&amp;gt;), what will happen? How can you tell gcc to link with the right library? (Hint: use the option &amp;quot;&amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt;&amp;quot;.) What is the corresponding library&#039;s file name?&lt;br /&gt;
    #include &amp;lt;math.h&amp;gt;&lt;br /&gt;
    double val = 9;&lt;br /&gt;
    printf(&amp;quot;The square root of 9 is %f\n&amp;quot;, sqrt(val));&lt;br /&gt;
&lt;br /&gt;
===Part C===&lt;br /&gt;
Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut2/3000memview.c 3000memview.c], then consider the following questions (if they turn out to be difficult, document your exploration and get some thinking).&lt;br /&gt;
&lt;br /&gt;
# Why are the addresses inconsistent between runs?&lt;br /&gt;
# Roughly where does the stack seem to be? The heap? Code? Global variables? (Hints: recall the memory image layout of a process discussed in the lecture; local variables go to the stack; initialized &#039;&#039;&#039;data&#039;&#039;&#039; and global variables go to the data segment, data allocated at runtime go to the heap.)&lt;br /&gt;
&amp;lt;!--# Change each &amp;lt;tt&amp;gt;malloc()&amp;lt;/tt&amp;gt; call to allocate more than 128K. What happens to the values of &amp;lt;tt&amp;gt;sbrk&amp;lt;/tt&amp;gt;? Why? (Hint: use &amp;lt;tt&amp;gt;strace&amp;lt;/tt&amp;gt;) --&amp;gt;&lt;br /&gt;
&amp;lt;!-- # Add more code and data to the program, and add more printf&#039;s to see where things are. Are things where you expect them to be? --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24946</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24946"/>
		<updated>2025-01-07T16:46:55Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;(Edit: the new image will be ready in a few days; before that you can use the [https://git.scs.carleton.ca/downloads/CourseVirtualMachines/2023F-2024W/COMP3000-W24.ova W24 image], almost the same except that security-wise no updates were performed)&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection such as the window and the desktop subsystems, and graphics rendering.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24945</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24945"/>
		<updated>2025-01-07T15:57:53Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; &amp;lt;small&amp;gt;Edit: the new image will be ready in a few days; before that you can use the [https://git.scs.carleton.ca/downloads/CourseVirtualMachines/2023F-2024W/COMP3000-W24.ova W24 image], almost the same except that security-wise no updates were performed)&amp;lt;/small&amp;gt; (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection such as the window and the desktop subsystems, and graphics rendering.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24944</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24944"/>
		<updated>2025-01-07T15:54:55Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; {{Edit: the new image will be ready in a few days; before that you can use the [https://git.scs.carleton.ca/downloads/CourseVirtualMachines/2023F-2024W/COMP3000-W24.ova W24 image], almost the same except that security-wise no updates were performed)}} (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection such as the window and the desktop subsystems, and graphics rendering.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24943</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24943"/>
		<updated>2025-01-07T15:54:27Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; {{smaller|Edit: the new image will be ready in a few days; before that you can use the [https://git.scs.carleton.ca/downloads/CourseVirtualMachines/2023F-2024W/COMP3000-W24.ova W24 image], almost the same except that security-wise no updates were performed)}} (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection such as the window and the desktop subsystems, and graphics rendering.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24942</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24942"/>
		<updated>2025-01-07T15:09:18Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN].&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
#;[[File:select-project-w25-400px.jpg]]&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] [[File:select-image-w25-580px.jpg]]&lt;br /&gt;
#; Flavor&lt;br /&gt;
#;[[File:select-flavor-w25-580px.jpg]]&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-flavor-w25-580px.jpg&amp;diff=24941</id>
		<title>File:Select-flavor-w25-580px.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-flavor-w25-580px.jpg&amp;diff=24941"/>
		<updated>2025-01-07T15:09:09Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24940</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24940"/>
		<updated>2025-01-07T15:05:10Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN].&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
#;[[File:select-project-w25-400px.jpg]]&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] [[File:select-image-w25-580px.jpg]]&lt;br /&gt;
#; Flavor&lt;br /&gt;
&amp;lt;!-- #;[[File:select-flavor-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-image-w25-580px.jpg&amp;diff=24939</id>
		<title>File:Select-image-w25-580px.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-image-w25-580px.jpg&amp;diff=24939"/>
		<updated>2025-01-07T15:05:03Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24938</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24938"/>
		<updated>2025-01-07T14:55:58Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN].&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
#;[[File:select-project-w25-400px.jpg]]&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] &amp;lt;!-- [[File:select-image-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
#; Flavor&lt;br /&gt;
&amp;lt;!-- #;[[File:select-flavor-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24937</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24937"/>
		<updated>2025-01-07T14:55:37Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN].&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
#;[[File:select-project-w24-400px.jpg]]&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] &amp;lt;!-- [[File:select-image-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
#; Flavor&lt;br /&gt;
&amp;lt;!-- #;[[File:select-flavor-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-project-w25-400px.jpg&amp;diff=24936</id>
		<title>File:Select-project-w25-400px.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-project-w25-400px.jpg&amp;diff=24936"/>
		<updated>2025-01-07T14:55:19Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24935</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24935"/>
		<updated>2025-01-04T19:25:50Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Learning to work with a text console without GUI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; (&#039;&#039;&#039;to be updated&#039;&#039;&#039;) (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection such as the window and the desktop subsystems, and graphics rendering.&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24934</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24934"/>
		<updated>2025-01-04T19:23:56Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; (&#039;&#039;&#039;to be updated&#039;&#039;&#039;) (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Learning to work with a text console without GUI===&lt;br /&gt;
You can take advantage of the graphical user interface (GUI) as much as possible, except when learning to use an OS. The command line interface is closer to the internal implementation of the OS, e.g., the commands being programs you execute, the arguments being what the OS understands, as well as saving multiple layers of indirection&lt;br /&gt;
&lt;br /&gt;
[https://github.com/tmux/tmux/wiki &#039;&#039;&#039;tmux&#039;&#039;&#039;] is a terminal multiplexer already installed in our VM (feel free to use your own alternatives). It avoids the need for opening multiple console windows or SSH sessions, which defeats the purpose of not using GUI. More importantly and usefully, tmux can help maintain your active sessions even if you accidentally get disconnected.&lt;br /&gt;
&lt;br /&gt;
To create a new session: press Ctrl-B and C&lt;br /&gt;
&lt;br /&gt;
To move between sessions: press Ctrl-B and N (or P)&lt;br /&gt;
&lt;br /&gt;
To list and attach to an existing session: &amp;lt;tt&amp;gt;tmux ls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tmux attach&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;tmux attach -t&amp;lt;/tt&amp;gt; session-id). Use &amp;lt;tt&amp;gt;man tmux&amp;lt;/tt&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24933</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24933"/>
		<updated>2025-01-04T07:11:20Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; (&#039;&#039;&#039;to be updated&#039;&#039;&#039;) (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24932</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24932"/>
		<updated>2025-01-04T07:10:59Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; (&#039;&#039;&#039;to be updated&#039;&#039;&#039;) (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24931</id>
		<title>COMP3000 Operating Systems W25: Tutorial 1</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Tutorial_1&amp;diff=24931"/>
		<updated>2025-01-04T07:09:48Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Note: this page&amp;#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&amp;#039;&amp;#039;&amp;#039;  This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu).   ==General Instructions (same for all tutorials)==  &amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt; Click...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This first tutorial will prepare you for subsequent tutorials. You will familiarize yourself with the OS environment and, in particular, learn the basics of command-line interaction in Linux (Ubuntu). &lt;br /&gt;
&lt;br /&gt;
==General Instructions (same for all tutorials)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Click on Expand to view.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Tutorials are graded based on participation and effort (&#039;&#039;&#039;so no need to struggle to have the “correct” answers — what matters is the attempts and sufficient thinking reflected in your answers&#039;&#039;&#039;). Submit your answers on Brightspace as a single text file named &amp;quot;&amp;lt;username&amp;gt;-comp3000-t&amp;lt;n&amp;gt;.txt&amp;quot; (where username is your MyCarletonOne username and n is the tutorial number). The first four lines of this file should be &amp;quot;COMP 3000 Tutorial &amp;lt;n&amp;gt;&amp;quot;, your name, student number, and the date of submission. Your submitted answers must at least respond to all the items in the &#039;&#039;&#039;Tasks/Questions&#039;&#039;&#039; section and include your thinking and exploration (or even confusion) for each question.&lt;br /&gt;
&lt;br /&gt;
The deadline is usually four days after the tutorial date (see the actual deadline on the submission entry under Tools -&amp;gt; Assignments). Note that the submission entry is enforced by the system, so you may fail to get the effort marks even if it is one minute past the deadline.&lt;br /&gt;
&lt;br /&gt;
You should also check in with your assigned TA. Your TA will be your first point of contact when you have questions or encounter any issues during the tutorial session. &lt;br /&gt;
&lt;br /&gt;
You get 1.5 marks for submitting answers that shows your effort and 0.5 for checking in, making this tutorial worth 2 points total.&lt;br /&gt;
&lt;br /&gt;
Read through the instructions before starting your work to get an overall picture. When source files are needed, you can download them by clicking on the hyperlink.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Started==&lt;br /&gt;
For the tutorials, you need to get access to a Linux machine. We strongly suggest you use an SCS Openstack instance (see the instructions below). Alternatively, if you have resource available and prefer to work offline with your desktop/laptop, you can also download &amp;lt;b&amp;gt;this VirtualBox image&amp;lt;/b&amp;gt; (&#039;&#039;&#039;to be updated&#039;&#039;&#039;) (which is the same with the Openstack image, and follow [https://carleton.ca/scs/2019/creating-a-new-host-only-adapter-in-virtualbox/ the instructions] to set up the host-only network adapter, after updating to &amp;lt;b&amp;gt;the latest version of VirtualBox&amp;lt;/b&amp;gt;). Note that as our VM is headless (i.e., no GUI desktop), you are supposed to only either use its local command line or connect to it via ssh. This is intended since you are learning to use an OS for which command-line access is the most native and close to its implementation for a better understanding, before you enjoy GUI in your future work. You will need access to a system for the entire semester, ideally the same one.&lt;br /&gt;
&lt;br /&gt;
The concepts covered below are mostly part of standard UNIX/Linux tutorials. Feel free to consult one or more of them. However, remember that you are trying to build a conceptual model of how things work. Thus, don&#039;t memorize commands; instead, try to understand how things fit together, learn how to find out the answer with that model, and ask questions when things don&#039;t work as expected!&lt;br /&gt;
&lt;br /&gt;
Feel free to discuss this tutorial on Teams.&lt;br /&gt;
&lt;br /&gt;
===Openstack===&lt;br /&gt;
&#039;&#039;&#039;For emphasis: do not take snapshots!&#039;&#039;&#039; (see below)&lt;br /&gt;
&lt;br /&gt;
You can create a VM on the SCS openstack by following [[COMP3000 Operating Systems W25: Openstack Instructions | &#039;&#039;&#039;these steps&#039;&#039;&#039;]]. If you encouter any issue and would like more reading, SCS already has [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/ lots of documentation on openstack], including a [https://carleton.ca/scs/tech-support/scs-open-stack/openstack-technical-support/openstack-step-by-step-guide/ step-by-step guide].&lt;br /&gt;
&lt;br /&gt;
Make sure of the key steps: ①Carleton VPN, ②refresh your SCS account if needed, ③the COMP3000-W25 project, ④the COMP3000-W25 &#039;&#039;&#039;snapshot&#039;&#039;&#039; image, ⑤adding the ping-ssh-egress security group, and ⑥associating a floating IP address.&lt;br /&gt;
&lt;br /&gt;
The 192.168.X.X IP addresses are private (and cannot be accessed outside of &#039;&#039;&#039;the Openstack cluster&#039;&#039;&#039;), the 134.117.X.X floating IP addresses can be accessed from &#039;&#039;&#039;the Carleton network&#039;&#039;&#039; and will allow you to access the wider Internet.&lt;br /&gt;
&lt;br /&gt;
You need to ssh to your VM instance, to do the tutorial work. Windows 10/11, Ubuntu and MacOS all have SSH clients available from their command lines. Just type &amp;quot;ssh student@&amp;lt;IP address&amp;gt;&amp;quot; where the IP address is the floating IP address you assigned to your VM. Other tools supporting SSH (e.g., PuTTY) also work.&lt;br /&gt;
Once you are prompted to log in, &#039;&#039;&#039;the default user is student, default password is student&#039;&#039;&#039;. You&#039;ll have to change your password once you are first logged in. (If you want to change your password later, use the &amp;lt;tt&amp;gt;passwd&amp;lt;/tt&amp;gt; command.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--For various alternative ways to acess your instance, refer to [[COMP3000 Operating Systems W24: Connecting to SCS Openstack | &#039;&#039;&#039;here&#039;&#039;&#039;]] (using the &amp;lt;tt&amp;gt;-J&amp;lt;/tt&amp;gt; option is recommended; take a look).--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image provides an &amp;quot;scs-backup&amp;quot; command that will backup the student user&#039;s directory to the SCS linux machines. So if your SCS username is janedoe, you can type:&lt;br /&gt;
&lt;br /&gt;
 scs-backup janedoe&lt;br /&gt;
&lt;br /&gt;
and it will create a copy of everything in the student account’s home directory (note: you can customize it) in a directory called &amp;quot;COMP3000VM-backup&amp;quot; in your SCS home directory. You can ssh/sftp to &amp;lt;tt&amp;gt;access.scs.carleton.ca&amp;lt;/tt&amp;gt; in order to access this copy of your VM&#039;s files. You should do backups at the end of every session and before you do anything dangerous.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that you cannot take snapshots of your VM, so please don&#039;t try (it will keep trying and never succeed, and you&#039;ll make work for the tech staff who have to cancel what you did).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Making use of Man pages===&lt;br /&gt;
The &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; (short for manual) command is a way to access the built-in software documentation system, whose entries come with the system and software packages.  For example, if you look at files in an installed software package (e.g., &amp;lt;tt&amp;gt;dpkg -L ftp&amp;lt;/tt&amp;gt; to list files in the ftp package) you can see there are a few files such as &amp;lt;tt&amp;gt;/usr/share/man/man1, 5, …&amp;lt;/tt&amp;gt; They are the man page entries (sections).&lt;br /&gt;
&lt;br /&gt;
The topics go beyond just software/command manuals, but also include conventions and abstract concepts (e.g., &amp;lt;tt&amp;gt;man syscalls&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;man man-pages&amp;lt;/tt&amp;gt;) that can serve as an info center. There are multiple sections for different purposes, which can be specified as the first argument, e.g., 1 for general commands, 2 for system calls, 3 for library functions, etc. For instance, tee is both a command (&amp;lt;tt&amp;gt;man 1 tee&amp;lt;/tt&amp;gt;) and a system call (&amp;lt;tt&amp;gt;man 2 tee&amp;lt;/tt&amp;gt;). A default will be used if the section is not specified.&lt;br /&gt;
&lt;br /&gt;
For any commands mentioned in the tutorials, you can use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find the usage. The advantage is the exact match with your current environment, compared to searching on the Internet.&lt;br /&gt;
&lt;br /&gt;
Compared to the summary and brief information provided by the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, you can also use the &amp;lt;tt&amp;gt;info&amp;lt;/tt&amp;gt; command for a more detailed explanation for certain topics (just give it a try).&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===The Shell===&lt;br /&gt;
The shell or command line provides a text interface for running programs. While not as visually pleasing as a graphical interface, the shell provides a clearer representation of the functionality provided by the operating system.&lt;br /&gt;
&lt;br /&gt;
It works as an interpreter of the commands the user enters, i.e., taking commands and sending them to the OS for execution. Typical shells include bash (the current default we are using in Ubuntu), ksh, zsh, csh, etc. You will learn how to change the current shell in Tutorial 4. Most modern shells also allow for the creation of a [https://en.wikipedia.org/wiki/Shell_script shell script], which is a sequence of such commands (programmed in a scripting language). You will see shell scripts as we move on with this course.&lt;br /&gt;
&lt;br /&gt;
===Permissions===&lt;br /&gt;
Your permission to access a file in Linux/Unix is determined by who you are logged in as. All files on the file system (including directories and other special files) have three different sets of permissions. The first set of permissions denotes the allowed file operations for &#039;&#039;&#039;the owner of the file&#039;&#039;&#039; (&#039;&#039;&#039;rwx&#039;&#039;&#039;rwxrwx). The second set of permissions denotes the allowed file operations for &#039;&#039;&#039;a group of users&#039;&#039;&#039; (rwx&#039;&#039;&#039;rwx&#039;&#039;&#039;rwx). The third set of permissions denotes the allowed file operations for &#039;&#039;&#039;everyone else&#039;&#039;&#039; (rwxrwx&#039;&#039;&#039;rwx&#039;&#039;&#039;). A file is always owned by someone and is always associated with a group. The set of permissions is threefold: read, write, and execute (rwx).&lt;br /&gt;
&lt;br /&gt;
===Environment &amp;amp; Shell Variables===&lt;br /&gt;
Environment variables on both Linux and Windows are variable-value pairs that define important context-related information (such as the name of the current user, the current language, the timezone) for applications. The key advantage of environment variables is that they are available right when a program starts - they are given to it by the operating system.&lt;br /&gt;
&lt;br /&gt;
In Linux, these environment variables can be printed on the command line in most shells by referring to the variable name prefixed with a $ sign (e.g., 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;
If a variable is private to the shell, it is called a shell variable. In bash, by default all variables are first shell variables. A shell variable becomes an environment variable, if you &amp;quot;export&amp;quot; it. For example:&lt;br /&gt;
&lt;br /&gt;
 X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
just defines X as a shell variable. However, if you then type:&lt;br /&gt;
&lt;br /&gt;
 export X&lt;br /&gt;
&lt;br /&gt;
X will be turned into an environment variable (no longer private), and so every subsequent program run by the shell will also get X. You can combine both in one line:&lt;br /&gt;
&lt;br /&gt;
 export X=&amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This is the idiom for setting environment variables normally. You will be able to better understand the differnces between shell variables and environment variables in later tutorials and assignments. Typically, you can access shell and environment variables using the same mechanism (the $ sign). &lt;br /&gt;
&lt;br /&gt;
One thing to remember with the above is that spaces are used to separate arguments in bash and most other UNIX shells. Thus, it is an error to type: &lt;br /&gt;
&lt;br /&gt;
 export X = &amp;quot;Important Data&amp;quot;&lt;br /&gt;
&lt;br /&gt;
as you now are giving export three arguments, not one.&lt;br /&gt;
&lt;br /&gt;
To delete an environment variable, you can &amp;lt;tt&amp;gt;unset X&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Downloading files using commands===&lt;br /&gt;
When working with the command line and you need to download a small number of files from a website (i.e., using the Web/HTTP protocol), you can choose one of the two below (use &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; to find out more if interested):&lt;br /&gt;
&lt;br /&gt;
 curl -o hello.c [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
 wget [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c https://people.scs.carleton.ca/~lianyingzhao/comp3000/w25/tut1/hello.c]&lt;br /&gt;
&lt;br /&gt;
In later tutorials/assignments, this will be useful as you need source files to do your work, for which the URL will be just a hyperlink on this wiki page or a PDF.&lt;br /&gt;
&lt;br /&gt;
===Compiling &amp;amp; Running Programs===&lt;br /&gt;
To compile a program, use &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gcc -O2 hello.c -o hello&lt;br /&gt;
&lt;br /&gt;
This compiles it with level 2 optimization and without debugging symbols, and the output program is hello.&lt;br /&gt;
&lt;br /&gt;
To run, you have to specify where it is (the single dot &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; represents your current directory):&lt;br /&gt;
&lt;br /&gt;
 ./hello&lt;br /&gt;
&lt;br /&gt;
Remember you can always change directories using the &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
==Tasks/Questions==&lt;br /&gt;
# When you have first logged in to a shell, &amp;lt;u&amp;gt;how&amp;lt;/u&amp;gt; (i.e., using what commands?) can you find out information about the environment? Consider the following as examples. Try to find out mutiple ways for each (if you can).&lt;br /&gt;
#* The version of your Linux distribution (in our case, Ubuntu) and the version of your Linux kernel.&lt;br /&gt;
#* Hardware information, e.g., RAM (remaining/total), CPU (model and number of cores), storage (what disks are connected and their capacity).&lt;br /&gt;
#* The name (binary path) of the current shell.&lt;br /&gt;
# Using the &amp;lt;tt&amp;gt;man&amp;lt;/tt&amp;gt; command, find out what the following commands do: &amp;lt;tt&amp;gt;which&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;pwd&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;who&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whoami&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;whereis&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;whatis&amp;lt;/tt&amp;gt;. &lt;br /&gt;
# Linux commands can be classified as internal (built into the shell) and external (separate program binaries). &amp;lt;u&amp;gt;How can you tell&amp;lt;/u&amp;gt; if a specific command (e.g., &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt;) is internal or external? &lt;br /&gt;
#* For the program you just compiled above, what happens if you use &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; to run it instead of &amp;lt;tt&amp;gt;./hello&amp;lt;/tt&amp;gt; (and why does that happen)?&lt;br /&gt;
#* Figure out where at least three external commands reside on the system. &lt;br /&gt;
# Making your own commands: the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; environment variable lists the directories the shell uses to search for external commands. Where can you find documentation on it? How can you add the current directory (whichever directory you are currently in) to PATH? Then, how to make that change permanent? Try to identify multiple ways. You can now revisit the question about &amp;quot;hello&amp;quot; above.&lt;br /&gt;
# Now, spend a few minutes to do a quick comparison: what are environment variables like in MS Windows? What are the two types? (hint: just search for &amp;quot;env&amp;quot; by clicking on the magnifier icon next to the Start menu of your Windows; you can also check its command line, if interested.)&lt;br /&gt;
# Going back to your Linux, look at the permissions of the program binaries of the external commands you have just found above. Who owns them? What group are they in?&lt;br /&gt;
# For those same program binaries, figure out what the permission bits mean by reading the man page of &amp;lt;tt&amp;gt;chmod&amp;lt;/tt&amp;gt; (this is the command you could use to change those permission bits). &lt;br /&gt;
# What are the owner, group, and permissions of &amp;lt;tt&amp;gt;/etc/passwd&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/etc/shadow&amp;lt;/tt&amp;gt;? What are these files used for (and &amp;lt;u&amp;gt;how did you find this out&amp;lt;/u&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: the permission bits above; all the files within a directory (including hidden files)? How to make a file hidden?&lt;br /&gt;
# Compile and run [https://people.scs.carleton.ca/~lianyingzhao/comp3000/w24/tut1/csimpleshell.c &amp;lt;tt&amp;gt;csimpleshell.c&amp;lt;/tt&amp;gt;]. &amp;lt;u&amp;gt;How does its functionality compare to that of &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;&amp;lt;/u&amp;gt;? List at least 3 differences.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24930</id>
		<title>COMP3000 Operating Systems W25: Downloading files from your Openstack VM</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24930"/>
		<updated>2025-01-04T03:45:25Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Using scp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;, which has a floating IP address associated. Here, you have a few options depending on your situation (assuming you have the Carleton VPN connected). Choose one that works for you or feel free to use other alternatives.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt;==&lt;br /&gt;
Secure file copy uses the same protocol as the secure shell (SSH), similar to the SSH command. &lt;br /&gt;
&lt;br /&gt;
 scp &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part in blue is an example pathname of the file to submit on your VM (make sure it matches your situation) and don&#039;t forget &#039;&#039;&#039;the last part in red, which is the destination directory on your PC&#039;&#039;&#039; (e.g., if could simply be a dot &amp;quot;.&amp;quot; representing your current directory, where you are typing this command).&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. This should work for both Windows and Linux-like systems.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt;==&lt;br /&gt;
You can also use the more secure and new command, &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. Likewise, also pay attention to the two locations (in red and blue).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24929</id>
		<title>COMP3000 Operating Systems W25: Downloading files from your Openstack VM</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Downloading_files_from_your_Openstack_VM&amp;diff=24929"/>
		<updated>2025-01-04T03:17:59Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Note: this page&amp;#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&amp;#039;&amp;#039;&amp;#039;  You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;,...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to transfer files between the Openstack VM and your own PC from time to time, for example, when submitting your tutorial/assignment work. As your laptop/desktop does not have a fixed IP the VM can connect to, it is always better to initiate the connection &amp;lt;b&amp;gt;from your PC to the VM&amp;lt;/b&amp;gt;, which has a floating IP address associated. Here, you have a few options depending on your situation (assuming you have the Carleton VPN connected). Choose one that works for you or feel free to use other alternatives.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt;==&lt;br /&gt;
Secure file copy uses the same protocol as the secure shell (SSH), similar to the SSH command. &lt;br /&gt;
&lt;br /&gt;
 scp &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The part in blue is an example pathname of the file to submit on your VM (make sure it matches your situation) and don&#039;t forget &#039;&#039;&#039;the last part in red, which is the destination directory on your PC&#039;&#039;&#039; (e.g., if could simple be a dot &amp;quot;.&amp;quot; representing your current directory, where you are typing this command).&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. This should work for both Windows and Linux-like systems.&lt;br /&gt;
&lt;br /&gt;
==Using &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt;==&lt;br /&gt;
You can also use the more secure and new command, &amp;lt;tt&amp;gt;rsync&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
 rsync -avhP &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;:/home/student/&amp;lt;CarletonUserName&amp;gt;-comp3000-assign1.tar.gz&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&amp;lt;YourLocalPath&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;lt;VMIP&amp;gt; with the floating IP address of your VM. Likewise, also pay attention to the two locations (in red and blue).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24928</id>
		<title>COMP3000 Operating Systems 2025W</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24928"/>
		<updated>2025-01-03T07:44:45Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* Various ways of  connecting to SCS Openstack */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Course Outline and Student Hours==&lt;br /&gt;
Aside from the updated version in Brightspace, you can also find it [https://outline.scs.carleton.ca/media/2025/W/COMP3000AW2025/COMP-3000-A-W-2025.pdf here]. Note that only the Brightspace version will contain contact information of the TAs and student hours.&lt;br /&gt;
&lt;br /&gt;
Follow the schedule to meet a TA in the corresponding room. Alternatively, you may also contact the instructor or TAs by email, on MS Teams or booking an appointment to meet online over Zoom.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extended student hours.&#039;&#039;&#039; Every one or two weeks, a Q&amp;amp;A session will be held online&lt;br /&gt;
with the instructor. This is similar to regular student hours except that multiple students will&lt;br /&gt;
be admitted into the session (like a class), and the focus is on lecture topics, e.g., you can ask&lt;br /&gt;
the instructor to re-explain a concept. For ad hoc technical problems, e.g., how to set up the&lt;br /&gt;
environment for a tutorial, please attend a TA’s student hours. The meeting time varies as intended&lt;br /&gt;
and will be announced below and on Brightspace so that if it does not work for a student, it likely will the next time. Priority will be given to students in Section B (if there are too many participants).&lt;br /&gt;
&lt;br /&gt;
==Tutorial Instructions==&lt;br /&gt;
Attending tutorials is required (there is a 0.5 participation mark each) and you need to submit the work by the deadline indicated on Brightspace (for the other 1.5 marks). What is submitted is not graded for correctness but effort showing your attempts and thinking. &amp;lt;u&amp;gt;To receive full marks, make sure to include in your submission how you arrived at the solution or other thoughts (if you figured it out) or any confusion/attempts or even disagreements (if you failed to)&amp;lt;/u&amp;gt;. After the submission, you should continue to study it if there is still anything you do not understand well, for the assignments and exams.&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Openstack Instructions | Instructions for setting up an Openstack instance]]===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ===Various ways of [[COMP3000 Operating Systems W25: Connecting to SCS Openstack | connecting to SCS Openstack]]=== --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Downloading files from your Openstack VM | Downloading files from your Openstack VM]]===&lt;br /&gt;
&lt;br /&gt;
===Tutorial 1===&lt;br /&gt;
Jan 9 and Jan 10, 2025: [[COMP3000 Operating Systems W25: Tutorial 1 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 2===&lt;br /&gt;
Jan 16 and Jan 17, 2025: [[COMP3000 Operating Systems W25: Tutorial 2 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 3===&lt;br /&gt;
Jan 23 and Jan 24, 2025: [[COMP3000 Operating Systems W25: Tutorial 3 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 4===&lt;br /&gt;
Jan 30 and Jan 31, 2025: [[COMP3000 Operating Systems W25: Tutorial 4 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 5===&lt;br /&gt;
Feb 6 and Feb 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 5 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 6===&lt;br /&gt;
Feb 27 and Feb 28, 2025: [[COMP3000 Operating Systems W25: Tutorial 6 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 7===&lt;br /&gt;
Mar 6 and Mar 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 7 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 8===&lt;br /&gt;
Mar 13 and Mar 14, 2025: [[COMP3000 Operating Systems W25: Tutorial 8 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 9===&lt;br /&gt;
Mar 20 and Mar 21, 2025: [[COMP3000 Operating Systems W25: Tutorial 9 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
==How to Do Well in This Course==&lt;br /&gt;
The goal here is to establish a &amp;lt;u&amp;gt;conceptual model&amp;lt;/u&amp;gt; to understand how operating systems work to serve applications. It is not a course like math or data structures. &#039;&#039;&#039;To succeed, you need to be more hands-on and focus on figuring out how to find the answers (like learning to fish) instead of the answers alone (like being given a fish)&#039;&#039;&#039;. You can NOT expect to do well only by reading course material. You must work with a real OS, with the course material as guidelines. As you progress, you should be gradually able to imagine how various pieces of the OS fit together to function, which will be very useful in your everyday work/life with computers.&lt;br /&gt;
&lt;br /&gt;
If you are asking a lot of &amp;quot;why&amp;quot;s, you are on the right track. Use all available resources (including the course material) as references, like a dictionary, to help answer your &amp;quot;why&amp;quot;s. For example, when you are asked about some information, based on your knowledge, think: 1) which part of the OS should have this information? 2) is it supposed to be available at the point in question? 3) then how do you retrieve that information? e.g., any tool/command/function call?&lt;br /&gt;
For sure, this would not be possible if you are just getting started, so a bit of confusion at the beginning is normal. As you move on, the conceptual model will become clearer as the basis for your thinking.&lt;br /&gt;
&lt;br /&gt;
Mandatory textbook reading will be posted on Brightspace, and thus not all of the textbook will be covered. The exams and assignments are based on lectures, tutorials and designated textbook chapters.&lt;br /&gt;
&lt;br /&gt;
The mini-quizzes are designed to ensure that you are following along by attending classes or listening to recorded lectures every week. So, they are straightforward, directly from class discussions (unlike the midterm and final exams).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Connecting_to_SCS_Openstack&amp;diff=24927</id>
		<title>COMP3000 Operating Systems W25: Connecting to SCS Openstack</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Connecting_to_SCS_Openstack&amp;diff=24927"/>
		<updated>2025-01-03T04:22:05Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: /* If you are tired of typing passwords */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you want to access the openstack environment during a video call (or when watching a movie online), please do not leave the Carleton VPN connected. You may also want to avoid your personal online activities going through the VPN or just simply need more convenience. Here are some alternative options. The instructions below assume you have created your VM instance with the VPN. Remember to replace &amp;lt;***&amp;gt; with your actual values.&lt;br /&gt;
==ProxyJump==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt;ssh -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This above is the easy and recommended way.&lt;br /&gt;
If your ssh version is a bit old, you may need to add a key exchange algorithm with:&lt;br /&gt;
&lt;br /&gt;
 ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ProxyJump - persistent==&lt;br /&gt;
&lt;br /&gt;
In your ssh config file (e.g., &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; for Linux and &amp;lt;tt&amp;gt;C:\Users\&amp;lt;UserName&amp;gt;\.ssh\config&amp;lt;/tt&amp;gt; for Windows 10/11):&lt;br /&gt;
&lt;br /&gt;
 Host access&lt;br /&gt;
 HostName access.scs.carleton.ca&lt;br /&gt;
 KexAlgorithms +diffie-hellman-group1-sha1&lt;br /&gt;
 User &amp;lt;CarletonUserName&amp;gt;&lt;br /&gt;
 Host 134.117.*&lt;br /&gt;
 ProxyJump access&lt;br /&gt;
 User &amp;lt;VMUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you can just &amp;lt;tt&amp;gt;ssh &amp;lt;VMIP&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Windows (older versions)==&lt;br /&gt;
&lt;br /&gt;
 ssh -o ProxyCommand=&amp;quot;C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Legacy (two terminal windows needed, not recommended)==&lt;br /&gt;
&lt;br /&gt;
 ssh -L 1200:&amp;lt;VMIP&amp;gt;:22 &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&lt;br /&gt;
&lt;br /&gt;
[stay logged in, and in another window do the following]&lt;br /&gt;
&lt;br /&gt;
 ssh -p 1200 &amp;lt;VMUserName&amp;gt;@localhost&lt;br /&gt;
&lt;br /&gt;
You can choose a port other than 1200.&lt;br /&gt;
&lt;br /&gt;
==If you are tired of typing passwords==&lt;br /&gt;
Follow [https://carleton.ca/scs/2019/passwordless-ssh-with-key-pairs/ these instructions] to set up your key pair to log in without having to remember a password. The instructions above for connecting to your instance are still needed, except that instead of typing a password every time you will be automatically logged in with the pre-configured key pair. &lt;br /&gt;
You will have a better understanding of this process when we discuss the security topics later in the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Connecting_to_SCS_Openstack&amp;diff=24926</id>
		<title>COMP3000 Operating Systems W25: Connecting to SCS Openstack</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Connecting_to_SCS_Openstack&amp;diff=24926"/>
		<updated>2025-01-03T04:17:53Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Note: this page&amp;#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&amp;#039;&amp;#039;&amp;#039;  If you want to access the openstack environment during a video call (or when watching a movie online), please do not leave the Carleton VPN connected. You may also want to avoid your personal online activities going through the VPN or just simply need more convenience. Here are some alternative optio...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you want to access the openstack environment during a video call (or when watching a movie online), please do not leave the Carleton VPN connected. You may also want to avoid your personal online activities going through the VPN or just simply need more convenience. Here are some alternative options. The instructions below assume you have created your VM instance with the VPN. Remember to replace &amp;lt;***&amp;gt; with your actual values.&lt;br /&gt;
==ProxyJump==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt;ssh -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This above is the easy and recommended way.&lt;br /&gt;
If your ssh version is a bit old, you may need to add a key exchange algorithm with:&lt;br /&gt;
&lt;br /&gt;
 ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -J &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca &amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ProxyJump - persistent==&lt;br /&gt;
&lt;br /&gt;
In your ssh config file (e.g., &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; for Linux and &amp;lt;tt&amp;gt;C:\Users\&amp;lt;UserName&amp;gt;\.ssh\config&amp;lt;/tt&amp;gt; for Windows 10/11):&lt;br /&gt;
&lt;br /&gt;
 Host access&lt;br /&gt;
 HostName access.scs.carleton.ca&lt;br /&gt;
 KexAlgorithms +diffie-hellman-group1-sha1&lt;br /&gt;
 User &amp;lt;CarletonUserName&amp;gt;&lt;br /&gt;
 Host 134.117.*&lt;br /&gt;
 ProxyJump access&lt;br /&gt;
 User &amp;lt;VMUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you can just &amp;lt;tt&amp;gt;ssh &amp;lt;VMIP&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Windows (older versions)==&lt;br /&gt;
&lt;br /&gt;
 ssh -o ProxyCommand=&amp;quot;C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&amp;quot; &amp;lt;VMUserName&amp;gt;@&amp;lt;VMIP&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Legacy (two terminal windows needed, not recommended)==&lt;br /&gt;
&lt;br /&gt;
 ssh -L 1200:&amp;lt;VMIP&amp;gt;:22 &amp;lt;CarletonUserName&amp;gt;@access.scs.carleton.ca&lt;br /&gt;
&lt;br /&gt;
[stay logged in, and in another window do the following]&lt;br /&gt;
&lt;br /&gt;
 ssh -p 1200 &amp;lt;VMUserName&amp;gt;@localhost&lt;br /&gt;
&lt;br /&gt;
You can choose a port other than 1200.&lt;br /&gt;
&lt;br /&gt;
==If you are tired of typing passwords==&lt;br /&gt;
Follow [https://carleton.ca/scs/2019/passwordless-ssh-with-key-pairs/ these instructions] to set up your key pair to log in without having to remember a password. You will have a better understanding of this process when we discuss the security topics later in the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24911</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24911"/>
		<updated>2024-12-31T00:19:18Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN].&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
&amp;lt;!--  #;[[File:select-project-w24-400px.jpg]] --&amp;gt;&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] &amp;lt;!-- [[File:select-image-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
#; Flavor&lt;br /&gt;
&amp;lt;!-- #;[[File:select-flavor-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24910</id>
		<title>COMP3000 Operating Systems W25: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_W25:_Openstack_Instructions&amp;diff=24910"/>
		<updated>2024-12-31T00:09:52Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:  (obvious steps are skipped)  # [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&amp;#039;s VPN]. # Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/] # Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the tutorials, by doing the following:&lt;br /&gt;
&lt;br /&gt;
(obvious steps are skipped)&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN].&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP3000-W25 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP3000-W25 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
&amp;lt;!--  #;[[File:select-project-w24-400px.jpg]] --&amp;gt;&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] &amp;lt;!-- [[File:select-image-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
#; Flavor&lt;br /&gt;
&amp;lt;!-- #;[[File:select-flavor-w24-580px.jpg]] --&amp;gt;&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24909</id>
		<title>COMP3000 Operating Systems 2025W</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP3000_Operating_Systems_2025W&amp;diff=24909"/>
		<updated>2024-12-27T04:01:29Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Note: this page&amp;#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&amp;#039;&amp;#039;&amp;#039;  ==Course Outline and Student Hours== Aside from the updated version in Brightspace, you can also find it [https://outline.scs.carleton.ca/media/2025/W/COMP3000AW2025/COMP-3000-A-W-2025.pdf here]. Note that only the Brightspace version will contain contact information of the TAs and student hours.  Fo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Note: this page&#039;s purpose is to host publicly available material linked from Brightspace. Please use Brightspace as the primary source of information to stay updated.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Course Outline and Student Hours==&lt;br /&gt;
Aside from the updated version in Brightspace, you can also find it [https://outline.scs.carleton.ca/media/2025/W/COMP3000AW2025/COMP-3000-A-W-2025.pdf here]. Note that only the Brightspace version will contain contact information of the TAs and student hours.&lt;br /&gt;
&lt;br /&gt;
Follow the schedule to meet a TA in the corresponding room. Alternatively, you may also contact the instructor or TAs by email, on MS Teams or booking an appointment to meet online over Zoom.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Extended student hours.&#039;&#039;&#039; Every one or two weeks, a Q&amp;amp;A session will be held online&lt;br /&gt;
with the instructor. This is similar to regular student hours except that multiple students will&lt;br /&gt;
be admitted into the session (like a class), and the focus is on lecture topics, e.g., you can ask&lt;br /&gt;
the instructor to re-explain a concept. For ad hoc technical problems, e.g., how to set up the&lt;br /&gt;
environment for a tutorial, please attend a TA’s student hours. The meeting time varies as intended&lt;br /&gt;
and will be announced below and on Brightspace so that if it does not work for a student, it likely will the next time. Priority will be given to students in Section B (if there are too many participants).&lt;br /&gt;
&lt;br /&gt;
==Tutorial Instructions==&lt;br /&gt;
Attending tutorials is required (there is a 0.5 participation mark each) and you need to submit the work by the deadline indicated on Brightspace (for the other 1.5 marks). What is submitted is not graded for correctness but effort showing your attempts and thinking. &amp;lt;u&amp;gt;To receive full marks, make sure to include in your submission how you arrived at the solution or other thoughts (if you figured it out) or any confusion/attempts or even disagreements (if you failed to)&amp;lt;/u&amp;gt;. After the submission, you should continue to study it if there is still anything you do not understand well, for the assignments and exams.&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Openstack Instructions | Instructions for setting up an Openstack instance]]===&lt;br /&gt;
&lt;br /&gt;
===Various ways of [[COMP3000 Operating Systems W25: Connecting to SCS Openstack | connecting to SCS Openstack]]===&lt;br /&gt;
&lt;br /&gt;
===[[COMP3000 Operating Systems W25: Downloading files from your Openstack VM | Downloading files from your Openstack VM]]===&lt;br /&gt;
&lt;br /&gt;
===Tutorial 1===&lt;br /&gt;
Jan 9 and Jan 10, 2025: [[COMP3000 Operating Systems W25: Tutorial 1 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 2===&lt;br /&gt;
Jan 16 and Jan 17, 2025: [[COMP3000 Operating Systems W25: Tutorial 2 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 3===&lt;br /&gt;
Jan 23 and Jan 24, 2025: [[COMP3000 Operating Systems W25: Tutorial 3 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 4===&lt;br /&gt;
Jan 30 and Jan 31, 2025: [[COMP3000 Operating Systems W25: Tutorial 4 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 5===&lt;br /&gt;
Feb 6 and Feb 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 5 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 6===&lt;br /&gt;
Feb 27 and Feb 28, 2025: [[COMP3000 Operating Systems W25: Tutorial 6 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 7===&lt;br /&gt;
Mar 6 and Mar 7, 2025: [[COMP3000 Operating Systems W25: Tutorial 7 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 8===&lt;br /&gt;
Mar 13 and Mar 14, 2025: [[COMP3000 Operating Systems W25: Tutorial 8 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
===Tutorial 9===&lt;br /&gt;
Mar 20 and Mar 21, 2025: [[COMP3000 Operating Systems W25: Tutorial 9 | Instructions]]&lt;br /&gt;
&lt;br /&gt;
==How to Do Well in This Course==&lt;br /&gt;
The goal here is to establish a &amp;lt;u&amp;gt;conceptual model&amp;lt;/u&amp;gt; to understand how operating systems work to serve applications. It is not a course like math or data structures. &#039;&#039;&#039;To succeed, you need to be more hands-on and focus on figuring out how to find the answers (like learning to fish) instead of the answers alone (like being given a fish)&#039;&#039;&#039;. You can NOT expect to do well only by reading course material. You must work with a real OS, with the course material as guidelines. As you progress, you should be gradually able to imagine how various pieces of the OS fit together to function, which will be very useful in your everyday work/life with computers.&lt;br /&gt;
&lt;br /&gt;
If you are asking a lot of &amp;quot;why&amp;quot;s, you are on the right track. Use all available resources (including the course material) as references, like a dictionary, to help answer your &amp;quot;why&amp;quot;s. For example, when you are asked about some information, based on your knowledge, think: 1) which part of the OS should have this information? 2) is it supposed to be available at the point in question? 3) then how do you retrieve that information? e.g., any tool/command/function call?&lt;br /&gt;
For sure, this would not be possible if you are just getting started, so a bit of confusion at the beginning is normal. As you move on, the conceptual model will become clearer as the basis for your thinking.&lt;br /&gt;
&lt;br /&gt;
Mandatory textbook reading will be posted on Brightspace, and thus not all of the textbook will be covered. The exams and assignments are based on lectures, tutorials and designated textbook chapters.&lt;br /&gt;
&lt;br /&gt;
The mini-quizzes are designed to ensure that you are following along by attending classes or listening to recorded lectures every week. So, they are straightforward, directly from class discussions (unlike the midterm and final exams).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Reading_list&amp;diff=24776</id>
		<title>COMP5900 COMP4900 2024F: Reading list</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Reading_list&amp;diff=24776"/>
		<updated>2024-10-08T00:40:13Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can only sign up for papers with an asterisk (*) at the end of their title.&lt;br /&gt;
&lt;br /&gt;
If you are looking for more papers (from which you consider choosing to present):&lt;br /&gt;
&lt;br /&gt;
[https://github.com/vschiavoni/sgx-papers Papers about/using Intel SGX]&lt;br /&gt;
&lt;br /&gt;
You can also check out these [https://github.com/Maxul/Awesome-SGX-Open-Source SGX Open Source Projects] (with or without papers).&lt;br /&gt;
&lt;br /&gt;
* Introduction to the course and trusted computing&lt;br /&gt;
**	[https://www.cs.ox.ac.uk/files/1873/RR-08-11.PDF The ten-page introduction to Trusted Computing]&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/7807249 Hardware-Based Trusted Computing Architectures for Isolation and Attestation]&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/7345265 Trusted Execution Environment: What It is, and What It is Not]&lt;br /&gt;
**  [https://dl.acm.org/doi/abs/10.1145/3672392 A Survey of Hardware Improvements to Secure Program Execution]&lt;br /&gt;
* Trust &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1849988 Bootstrapping Trust in Commodity Computers]&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=358210 Reflections on Trusting Trust] (Turing Award lecture, 1984)&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=3186101 SafeKeeper: Protecting Web Passwords using Trusted Execution Environments]&lt;br /&gt;
* Application of TC technologies&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/osdi16/osdi16-arnautov.pdf SCONE: Secure Linux Containers with Intel SGX] (*)  &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt; Recommended &amp;lt;/span&amp;gt;&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8464097 SGX-Tor: A Secure and Practical Tor Anonymity Network with SGX Enclaves] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8418608 EnclaveDB: A Secure Database using SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3052973.3053034 SGX-Log: Securing System Logs with SGX] (*)&lt;br /&gt;
**	OS integrity: [https://link.springer.com/chapter/10.1007/978-3-030-29962-0_11 Nighthawk: Transparent System Introspection from Ring -3] (*)&lt;br /&gt;
**	Hypervisor integrity: [https://ieeexplore.ieee.org/abstract/document/6682894 HyperCheck: A Hardware-Assisted Integrity Monitor] (*)&lt;br /&gt;
**	Data protection: [https://dl.acm.org/doi/abs/10.1145/3190508.3190518 Pesos: Policy Enhanced Secure Object Store] (*)&lt;br /&gt;
* Making TC technologies more adoptable/usable&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1352625 Flicker: An Execution Infrastructure for TCB Minimization] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/atc17/atc17-lind.pdf Glamdring: Automatic Application Partitioning for Intel SGX] (*)&lt;br /&gt;
**  [https://www.usenix.org/conference/atc17/technical-sessions/presentation/tsai Graphene-SGX: A Practical Library OS for Unmodified Applications on SGX] (*)   &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt; Recommended &amp;lt;/span&amp;gt;&lt;br /&gt;
**	[https://dl.acm.org/doi/pdf/10.1145/3373376.3378469 Occlum: Secure and Efficient Multitasking Inside a Single Enclave of Intel SGX] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/sec20spring_tsai_prepub.pdf Civet: An Efficient Java Partitioning Framework for Hardware Enclaves] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-hua.pdf vTZ: Virtualizing ARM TrustZone] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/3319535.3354241 Towards Memory Safe Enclave Programming with Rust-SGX] [Rust + SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/3427228.3427262 RusTEE: Developing Memory-Safe ARM TrustZone Applications] [Rust + ARM] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/abstract/document/8945648 SGXPy: Protecting integrity of Python applications with Intel SGX] [Python + SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/2541940.2541949 Using ARM TrustZone to Build a Trusted Language Runtime for Mobile Applications] [.NET + SGX] (*)&lt;br /&gt;
* Side-channel attacks&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8141882 Systematic Classification of Side-Channel Attacks: A Case Study for Mobile Devices]&lt;br /&gt;
**	[https://www.usenix.org/conference/usenixsecurity18/presentation/bulck Foreshadow: Extracting the Keys to the Intel SGX Kingdom with Transient Out-of-Order Execution] (*)&lt;br /&gt;
**	[https://www.usenix.org/conference/usenixsecurity18/presentation/lipp Meltdown: Reading Kernel Memory from User Space] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/abstract/document/8835233 Spectre Attacks: Exploiting Speculative Execution] (*)&lt;br /&gt;
**	Latest: [https://www.usenix.org/system/files/usenixsecurity23-moghimi.pdf Downfall: Exploiting Speculative Data Gathering] (*)&lt;br /&gt;
* Internal misbehavior: memory attacks &lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/6547101 SoK: Eternal War in Memory] (*)&lt;br /&gt;
**	[https://link.springer.com/chapter/10.1007/978-3-642-33338-5_5 Memory Errors: The Past, the Present, and the Future]&lt;br /&gt;
**	Defense: [https://dl.acm.org/doi/abs/10.1145/2976749.2978358 C-FLAT: Control-Flow Attestation for Embedded Systems Software] (*)&lt;br /&gt;
**	Defense: [https://www.usenix.org/system/files/sec21summer_mirzazade.pdf PTAuth: Temporal Memory Safety via Robust Points-to Authentication] (*)&lt;br /&gt;
**	Attacking the defense: [https://dl.acm.org/doi/abs/10.1145/3470496.3527429 PACMAN: Attacking ARM Pointer Authentication with Speculative Execution] (*)&lt;br /&gt;
**	Attacking the defense: [https://arxiv.org/pdf/2406.08719 TIKTAG: Breaking ARM’s Memory Tagging Extension with Speculative Execution] (*)&lt;br /&gt;
* Human authenticating machine&lt;br /&gt;
**	[https://www.usenix.org/legacy/event/hotsec07/tech/full_papers/mccune/mccune.pdf Turtles All The Way Down: Research Challenges in User-Based Attestation]&lt;br /&gt;
**	[https://fc13.ifca.ai/proc/9-1.pdf Stark: Tamperproof Authentication to Resist Keylogging] (*)&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1854103 Evil maid goes after PGP whole disk encryption]&lt;br /&gt;
**	[https://netsec.ethz.ch/publications/papers/PRISM-2007.pdf PRISM/ Human-Verifiable Code Execution] (*)&lt;br /&gt;
* State continuity&lt;br /&gt;
**	[https://www.microsoft.com/en-us/research/publication/memoir-practical-state-continuity-for-protected-modules/ Memoir: Practical state continuity for protected modules] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-matetic.pdf ROTE: Rollback Protection for Trusted Execution] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity16/sec16_paper_strackx.pdf Ariadne: A Minimal Approach to State Continuity] (*)&lt;br /&gt;
* Secure input/output&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3210240.3210334 SeCloak: ARM TrustZone-based Mobile Peripheral Control]&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=2637225 Building trusted path on untrusted device drivers for mobile devices] (*) &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=3210338 TruZ-Droid: Integrating TrustZone with Mobile Operating System] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8859293 Establishing Trusted I/O Paths for SGX Client Systems with Aurora] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3210240.3210330 VButton: Practical Attestation of User-driven Operations in Mobile Apps] (*)&lt;br /&gt;
**	[https://www.ndss-symposium.org/ndss-paper/protection-root-of-trust-for-io-in-compromised-platforms/ ProtectIOn: Root-of-Trust for IO in Compromised Platforms] (*)&lt;br /&gt;
**	[https://ieeexplore-ieee-org.ezproxy.u-pec.fr/iel7/8826229/8835208/08835331.pdf Fidelius: Protecting User Secrets from Compromised Browsers] (*)&lt;br /&gt;
* Proposed hardware improvements&lt;br /&gt;
**	Fine-grained isolation: [https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-frassetto.pdf IMIX: In-Process Memory Isolation EXtension] (*)&lt;br /&gt;
**	Memory safety: [https://ieeexplore.ieee.org/abstract/document/7167258 HAFIX: Hardware-Assisted Flow Integrity Extension] (*)&lt;br /&gt;
**	Integrity monitoring: [https://dl.acm.org/doi/10.1145/3134600.3134622 Co-processor-based Behavior Monitoring: Application to the Detection of Attacks Against the System Management Mode] (*)&lt;br /&gt;
**	Integrity monitoring: [https://dl.acm.org/doi/abs/10.1145/2508148.2485956 CPU Transparent Protection of OS Kernel and Hypervisor Integrity with Programmable DRAM] (*)&lt;br /&gt;
* Proposals based on existing (non-security) hardware support &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=2660316&amp;amp;dl=ACM&amp;amp;coll=DL PixelVault: Using GPUs for Securing Cryptographic Operations] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/osdi18-volos.pdf Graviton: Trusted Execution Environments on GPUs] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3093337.3037716 GRIFFIN: Guarding Control Flows Using Intel Processor Trace] (*)&lt;br /&gt;
**	[https://www.ndss-symposium.org/wp-content/uploads/2017/09/ndss2017_07-2_Shih_paper.pdf T-SGX: Eradicating Controlled-Channel Attacks Against Enclave Programs] (*)&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Openstack_Instructions&amp;diff=24704</id>
		<title>COMP5900 COMP4900 2024F: Openstack Instructions</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Openstack_Instructions&amp;diff=24704"/>
		<updated>2024-09-18T17:18:06Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can create a VM instance on the [https://carleton.ca/scs/tech-support/scs-open-stack/ SCS openstack] cluster for the assignments, by doing the following:&lt;br /&gt;
&lt;br /&gt;
Obvious steps are skipped. You can always reach out to the TA or the instructor for any technical questions.&lt;br /&gt;
&lt;br /&gt;
# [https://carleton.ca/its/help-centre/remote-access/ Connect to Carleton&#039;s VPN] (if not on campus).&lt;br /&gt;
# Log in to [https://openstack-stein.scs.carleton.ca/ https://openstack-stein.scs.carleton.ca/]&lt;br /&gt;
# Most of you would need to refresh your SCS account to have the right entitlements for our course (or you may not be able to log in or not listed in the COMP4900K-F24 project): https://newacct.scs.carleton.ca/scs_authentication/newacct-policy-form.php&lt;br /&gt;
# Switch to the COMP4900K-F24 project (top-left corner), and launch an instance (button on the right).&lt;br /&gt;
#;[[File:select-project-f24.jpg|300px]]&lt;br /&gt;
# Make a choice for necessary items according to the screenshots attached.&lt;br /&gt;
#;[[File:boot-source.jpg|300px]] [[File:select-image-f24.jpg|580px]] &lt;br /&gt;
#; Flavor&lt;br /&gt;
#;[[File:select-flavor-f24.jpg|580px]]&lt;br /&gt;
# You must add &amp;quot;ping-ssh-egress&amp;quot; to the security groups, or you&#039;ll not be able to ping/ssh to your instance.&lt;br /&gt;
#; Security groups:&lt;br /&gt;
#;[[File:security-group.jpg|580px]]&lt;br /&gt;
# Assign a floating IP.&lt;br /&gt;
#;[[File:floating-ip.jpg|170px]]&lt;br /&gt;
#; NEVER attempt to create a snapshot&lt;br /&gt;
# Then the new IP address (134.117.XXX.XXX) to the right of 192.168.XXX.XXX will be the one (floating IP) you will use to connect to your instance.&lt;br /&gt;
# &amp;lt;u&amp;gt;Note down&amp;lt;/u&amp;gt; your floating IP and your instance name for subsequent uses for the rest of the term.&lt;br /&gt;
# Log in to your instance with username &amp;quot;student&amp;quot; and password &amp;quot;student&amp;quot; (you will be prompted to change your password right away).&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Reading_list&amp;diff=24701</id>
		<title>COMP5900 COMP4900 2024F: Reading list</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Reading_list&amp;diff=24701"/>
		<updated>2024-09-18T00:56:22Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can only sign up for papers with an asterisk (*) at the end of their title.&lt;br /&gt;
&lt;br /&gt;
If you are looking for more papers (from which you consider choosing to present):&lt;br /&gt;
&lt;br /&gt;
[https://github.com/vschiavoni/sgx-papers Papers about/using Intel SGX]&lt;br /&gt;
&lt;br /&gt;
You can also check out these [https://github.com/Maxul/Awesome-SGX-Open-Source SGX Open Source Projects] (with or without papers).&lt;br /&gt;
&lt;br /&gt;
* Introduction to the course and trusted computing&lt;br /&gt;
**	[https://www.cs.ox.ac.uk/files/1873/RR-08-11.PDF The ten-page introduction to Trusted Computing]&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/7807249 Hardware-Based Trusted Computing Architectures for Isolation and Attestation]&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/7345265 Trusted Execution Environment: What It is, and What It is Not]&lt;br /&gt;
**  [https://dl.acm.org/doi/abs/10.1145/3672392 A Survey of Hardware Improvements to Secure Program Execution]&lt;br /&gt;
* Trust &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1849988 Bootstrapping Trust in Commodity Computers]&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=358210 Reflections on Trusting Trust] (Turing Award lecture, 1984)&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=3186101 SafeKeeper: Protecting Web Passwords using Trusted Execution Environments]&lt;br /&gt;
* Application of TC technologies&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/osdi16/osdi16-arnautov.pdf SCONE: Secure Linux Containers with Intel SGX] (*)  &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt; Recommended &amp;lt;/span&amp;gt;&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8464097 SGX-Tor: A Secure and Practical Tor Anonymity Network with SGX Enclaves] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8418608 EnclaveDB: A Secure Database using SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3052973.3053034 SGX-Log: Securing System Logs with SGX] (*)&lt;br /&gt;
**	OS integrity: [https://link.springer.com/chapter/10.1007/978-3-030-29962-0_11 Nighthawk: Transparent System Introspection from Ring -3] (*)&lt;br /&gt;
**	Hypervisor integrity: [https://ieeexplore.ieee.org/abstract/document/6682894 HyperCheck: A Hardware-Assisted Integrity Monitor] (*)&lt;br /&gt;
**	Data protection: [https://dl.acm.org/doi/abs/10.1145/3190508.3190518 Pesos: Policy Enhanced Secure Object Store] (*)&lt;br /&gt;
* Making TC technologies more adoptable/usable&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1352625 Flicker: An Execution Infrastructure for TCB Minimization] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/atc17/atc17-lind.pdf Glamdring: Automatic Application Partitioning for Intel SGX] (*)&lt;br /&gt;
**  [https://www.usenix.org/conference/atc17/technical-sessions/presentation/tsai Graphene-SGX: A Practical Library OS for Unmodified Applications on SGX] (*)   &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt; Recommended &amp;lt;/span&amp;gt;&lt;br /&gt;
**	[https://dl.acm.org/doi/pdf/10.1145/3373376.3378469 Occlum: Secure and Efficient Multitasking Inside a Single Enclave of Intel SGX] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/sec20spring_tsai_prepub.pdf Civet: An Efficient Java Partitioning Framework for Hardware Enclaves] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-hua.pdf vTZ: Virtualizing ARM TrustZone] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/3319535.3354241 Towards Memory Safe Enclave Programming with Rust-SGX] [Rust + SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/3427228.3427262 RusTEE: Developing Memory-Safe ARM TrustZone Applications] [Rust + ARM] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/abstract/document/8945648 SGXPy: Protecting integrity of Python applications with Intel SGX] [Python + SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/2541940.2541949 Using ARM TrustZone to Build a Trusted Language Runtime for Mobile Applications] [.NET + SGX] (*)&lt;br /&gt;
* Side-channel attacks&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8141882 Systematic Classification of Side-Channel Attacks: A Case Study for Mobile Devices]&lt;br /&gt;
**	[https://www.usenix.org/conference/usenixsecurity18/presentation/bulck Foreshadow: Extracting the Keys to the Intel SGX Kingdom with Transient Out-of-Order Execution] (*)&lt;br /&gt;
**	[https://www.usenix.org/conference/usenixsecurity18/presentation/lipp Meltdown: Reading Kernel Memory from User Space] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/abstract/document/8835233 Spectre Attacks: Exploiting Speculative Execution] (*)&lt;br /&gt;
**	Latest: [https://www.usenix.org/system/files/usenixsecurity23-moghimi.pdf Downfall: Exploiting Speculative Data Gathering] (*)&lt;br /&gt;
* Internal misbehavior: memory attacks &lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/6547101 SoK: Eternal War in Memory] (*)&lt;br /&gt;
**	[https://link.springer.com/chapter/10.1007/978-3-642-33338-5_5 Memory Errors: The Past, the Present, and the Future]&lt;br /&gt;
**	Defense: [https://dl.acm.org/doi/abs/10.1145/2976749.2978358 C-FLAT: Control-Flow Attestation for Embedded Systems Software] (*)&lt;br /&gt;
**	Defense: [https://www.usenix.org/system/files/sec21summer_mirzazade.pdf PTAuth: Temporal Memory Safety via Robust Points-to Authentication] (*)&lt;br /&gt;
**	Attacking the defense: [https://dl.acm.org/doi/abs/10.1145/3470496.3527429 PACMAN: Attacking ARM Pointer Authentication with Speculative Execution] (*)&lt;br /&gt;
* Human authenticating machine&lt;br /&gt;
**	[https://www.usenix.org/legacy/event/hotsec07/tech/full_papers/mccune/mccune.pdf Turtles All The Way Down: Research Challenges in User-Based Attestation]&lt;br /&gt;
**	[https://fc13.ifca.ai/proc/9-1.pdf Stark: Tamperproof Authentication to Resist Keylogging] (*)&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1854103 Evil maid goes after PGP whole disk encryption]&lt;br /&gt;
**	[https://netsec.ethz.ch/publications/papers/PRISM-2007.pdf PRISM/ Human-Verifiable Code Execution] (*)&lt;br /&gt;
* State continuity&lt;br /&gt;
**	[https://www.microsoft.com/en-us/research/publication/memoir-practical-state-continuity-for-protected-modules/ Memoir: Practical state continuity for protected modules] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-matetic.pdf ROTE: Rollback Protection for Trusted Execution] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity16/sec16_paper_strackx.pdf Ariadne: A Minimal Approach to State Continuity] (*)&lt;br /&gt;
* Secure input/output&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3210240.3210334 SeCloak: ARM TrustZone-based Mobile Peripheral Control]&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=2637225 Building trusted path on untrusted device drivers for mobile devices] (*) &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=3210338 TruZ-Droid: Integrating TrustZone with Mobile Operating System] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8859293 Establishing Trusted I/O Paths for SGX Client Systems with Aurora] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3210240.3210330 VButton: Practical Attestation of User-driven Operations in Mobile Apps] (*)&lt;br /&gt;
**	[https://www.ndss-symposium.org/ndss-paper/protection-root-of-trust-for-io-in-compromised-platforms/ ProtectIOn: Root-of-Trust for IO in Compromised Platforms] (*)&lt;br /&gt;
**	[https://ieeexplore-ieee-org.ezproxy.u-pec.fr/iel7/8826229/8835208/08835331.pdf Fidelius: Protecting User Secrets from Compromised Browsers] (*)&lt;br /&gt;
* Proposed hardware improvements&lt;br /&gt;
**	Fine-grained isolation: [https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-frassetto.pdf IMIX: In-Process Memory Isolation EXtension] (*)&lt;br /&gt;
**	Memory safety: [https://ieeexplore.ieee.org/abstract/document/7167258 HAFIX: Hardware-Assisted Flow Integrity Extension] (*)&lt;br /&gt;
**	Integrity monitoring: [https://dl.acm.org/doi/10.1145/3134600.3134622 Co-processor-based Behavior Monitoring: Application to the Detection of Attacks Against the System Management Mode] (*)&lt;br /&gt;
**	Integrity monitoring: [https://dl.acm.org/doi/abs/10.1145/2508148.2485956 CPU Transparent Protection of OS Kernel and Hypervisor Integrity with Programmable DRAM] (*)&lt;br /&gt;
* Proposals based on existing (non-security) hardware support &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=2660316&amp;amp;dl=ACM&amp;amp;coll=DL PixelVault: Using GPUs for Securing Cryptographic Operations] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/osdi18-volos.pdf Graviton: Trusted Execution Environments on GPUs] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3093337.3037716 GRIFFIN: Guarding Control Flows Using Intel Processor Trace] (*)&lt;br /&gt;
**	[https://www.ndss-symposium.org/wp-content/uploads/2017/09/ndss2017_07-2_Shih_paper.pdf T-SGX: Eradicating Controlled-Channel Attacks Against Enclave Programs] (*)&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Reading_list&amp;diff=24700</id>
		<title>COMP5900 COMP4900 2024F: Reading list</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP5900_COMP4900_2024F:_Reading_list&amp;diff=24700"/>
		<updated>2024-09-18T00:45:11Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can only sign up for papers with an asterisk (*) at the end of their title.&lt;br /&gt;
&lt;br /&gt;
If you are looking for more papers (from which you consider choosing to present):&lt;br /&gt;
&lt;br /&gt;
[https://github.com/vschiavoni/sgx-papers Papers about/using Intel SGX]&lt;br /&gt;
&lt;br /&gt;
You can also check out these [https://github.com/Maxul/Awesome-SGX-Open-Source SGX Open Source Projects] (with or without papers).&lt;br /&gt;
&lt;br /&gt;
* Introduction to the course and trusted computing&lt;br /&gt;
**	[https://www.cs.ox.ac.uk/files/1873/RR-08-11.PDF The ten-page introduction to Trusted Computing]&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/7807249 Hardware-Based Trusted Computing Architectures for Isolation and Attestation]&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/7345265 Trusted Execution Environment: What It is, and What It is Not]&lt;br /&gt;
**  [https://dl.acm.org/doi/abs/10.1145/3672392 A Survey of Hardware Improvements to Secure Program Execution]&lt;br /&gt;
* Trust &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1849988 Bootstrapping Trust in Commodity Computers]&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=358210 Reflections on Trusting Trust] (Turing Award lecture, 1984)&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=3186101 SafeKeeper: Protecting Web Passwords using Trusted Execution Environments]&lt;br /&gt;
* Application of TC technologies&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/osdi16/osdi16-arnautov.pdf SCONE: Secure Linux Containers with Intel SGX] (*)  &amp;lt;span style=&amp;quot;color:#0000ff;font-weight:bold&amp;quot;&amp;gt; Recommended &amp;lt;/span&amp;gt;&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8464097 SGX-Tor: A Secure and Practical Tor Anonymity Network with SGX Enclaves] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8418608 EnclaveDB: A Secure Database using SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3052973.3053034 SGX-Log: Securing System Logs with SGX] (*)&lt;br /&gt;
**	OS integrity: [https://link.springer.com/chapter/10.1007/978-3-030-29962-0_11 Nighthawk: Transparent System Introspection from Ring -3] (*)&lt;br /&gt;
**	Hypervisor integrity: [https://ieeexplore.ieee.org/abstract/document/6682894 HyperCheck: A Hardware-Assisted Integrity Monitor] (*)&lt;br /&gt;
**	Data protection: [https://dl.acm.org/doi/abs/10.1145/3190508.3190518 Pesos: Policy Enhanced Secure Object Store] (*)&lt;br /&gt;
* Making TC technologies more adoptable/usable&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1352625 Flicker: An Execution Infrastructure for TCB Minimization] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/atc17/atc17-lind.pdf Glamdring: Automatic Application Partitioning for Intel SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/pdf/10.1145/3373376.3378469 Occlum: Secure and Efficient Multitasking Inside a Single Enclave of Intel SGX] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/sec20spring_tsai_prepub.pdf Civet: An Efficient Java Partitioning Framework for Hardware Enclaves] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-hua.pdf vTZ: Virtualizing ARM TrustZone] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/3319535.3354241 Towards Memory Safe Enclave Programming with Rust-SGX] [Rust + SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/3427228.3427262 RusTEE: Developing Memory-Safe ARM TrustZone Applications] [Rust + ARM] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/abstract/document/8945648 SGXPy: Protecting integrity of Python applications with Intel SGX] [Python + SGX] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/abs/10.1145/2541940.2541949 Using ARM TrustZone to Build a Trusted Language Runtime for Mobile Applications] [.NET + SGX] (*)&lt;br /&gt;
* Side-channel attacks&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8141882 Systematic Classification of Side-Channel Attacks: A Case Study for Mobile Devices]&lt;br /&gt;
**	[https://www.usenix.org/conference/usenixsecurity18/presentation/bulck Foreshadow: Extracting the Keys to the Intel SGX Kingdom with Transient Out-of-Order Execution] (*)&lt;br /&gt;
**	[https://www.usenix.org/conference/usenixsecurity18/presentation/lipp Meltdown: Reading Kernel Memory from User Space] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/abstract/document/8835233 Spectre Attacks: Exploiting Speculative Execution] (*)&lt;br /&gt;
**	Latest: [https://www.usenix.org/system/files/usenixsecurity23-moghimi.pdf Downfall: Exploiting Speculative Data Gathering] (*)&lt;br /&gt;
* Internal misbehavior: memory attacks &lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/6547101 SoK: Eternal War in Memory] (*)&lt;br /&gt;
**	[https://link.springer.com/chapter/10.1007/978-3-642-33338-5_5 Memory Errors: The Past, the Present, and the Future]&lt;br /&gt;
**	Defense: [https://dl.acm.org/doi/abs/10.1145/2976749.2978358 C-FLAT: Control-Flow Attestation for Embedded Systems Software] (*)&lt;br /&gt;
**	Defense: [https://www.usenix.org/system/files/sec21summer_mirzazade.pdf PTAuth: Temporal Memory Safety via Robust Points-to Authentication] (*)&lt;br /&gt;
**	Attacking the defense: [https://dl.acm.org/doi/abs/10.1145/3470496.3527429 PACMAN: Attacking ARM Pointer Authentication with Speculative Execution] (*)&lt;br /&gt;
* Human authenticating machine&lt;br /&gt;
**	[https://www.usenix.org/legacy/event/hotsec07/tech/full_papers/mccune/mccune.pdf Turtles All The Way Down: Research Challenges in User-Based Attestation]&lt;br /&gt;
**	[https://fc13.ifca.ai/proc/9-1.pdf Stark: Tamperproof Authentication to Resist Keylogging] (*)&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=1854103 Evil maid goes after PGP whole disk encryption]&lt;br /&gt;
**	[https://netsec.ethz.ch/publications/papers/PRISM-2007.pdf PRISM/ Human-Verifiable Code Execution] (*)&lt;br /&gt;
* State continuity&lt;br /&gt;
**	[https://www.microsoft.com/en-us/research/publication/memoir-practical-state-continuity-for-protected-modules/ Memoir: Practical state continuity for protected modules] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity17/sec17-matetic.pdf ROTE: Rollback Protection for Trusted Execution] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/conference/usenixsecurity16/sec16_paper_strackx.pdf Ariadne: A Minimal Approach to State Continuity] (*)&lt;br /&gt;
* Secure input/output&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3210240.3210334 SeCloak: ARM TrustZone-based Mobile Peripheral Control]&lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=2637225 Building trusted path on untrusted device drivers for mobile devices] (*) &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=3210338 TruZ-Droid: Integrating TrustZone with Mobile Operating System] (*)&lt;br /&gt;
**	[https://ieeexplore.ieee.org/document/8859293 Establishing Trusted I/O Paths for SGX Client Systems with Aurora] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3210240.3210330 VButton: Practical Attestation of User-driven Operations in Mobile Apps] (*)&lt;br /&gt;
**	[https://www.ndss-symposium.org/ndss-paper/protection-root-of-trust-for-io-in-compromised-platforms/ ProtectIOn: Root-of-Trust for IO in Compromised Platforms] (*)&lt;br /&gt;
**	[https://ieeexplore-ieee-org.ezproxy.u-pec.fr/iel7/8826229/8835208/08835331.pdf Fidelius: Protecting User Secrets from Compromised Browsers] (*)&lt;br /&gt;
* Proposed hardware improvements&lt;br /&gt;
**	Fine-grained isolation: [https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-frassetto.pdf IMIX: In-Process Memory Isolation EXtension] (*)&lt;br /&gt;
**	Memory safety: [https://ieeexplore.ieee.org/abstract/document/7167258 HAFIX: Hardware-Assisted Flow Integrity Extension] (*)&lt;br /&gt;
**	Integrity monitoring: [https://dl.acm.org/doi/10.1145/3134600.3134622 Co-processor-based Behavior Monitoring: Application to the Detection of Attacks Against the System Management Mode] (*)&lt;br /&gt;
**	Integrity monitoring: [https://dl.acm.org/doi/abs/10.1145/2508148.2485956 CPU Transparent Protection of OS Kernel and Hypervisor Integrity with Programmable DRAM] (*)&lt;br /&gt;
* Proposals based on existing (non-security) hardware support &lt;br /&gt;
**	[https://dl.acm.org/citation.cfm?id=2660316&amp;amp;dl=ACM&amp;amp;coll=DL PixelVault: Using GPUs for Securing Cryptographic Operations] (*)&lt;br /&gt;
**	[https://www.usenix.org/system/files/osdi18-volos.pdf Graviton: Trusted Execution Environments on GPUs] (*)&lt;br /&gt;
**	[https://dl.acm.org/doi/10.1145/3093337.3037716 GRIFFIN: Guarding Control Flows Using Intel Processor Trace] (*)&lt;br /&gt;
**	[https://www.ndss-symposium.org/wp-content/uploads/2017/09/ndss2017_07-2_Shih_paper.pdf T-SGX: Eradicating Controlled-Channel Attacks Against Enclave Programs] (*)&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-project-f24.jpg&amp;diff=24670</id>
		<title>File:Select-project-f24.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-project-f24.jpg&amp;diff=24670"/>
		<updated>2024-09-10T22:49:44Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Lianyingzhao uploaded a new version of File:Select-project-f24.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-image-f24.jpg&amp;diff=24669</id>
		<title>File:Select-image-f24.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-image-f24.jpg&amp;diff=24669"/>
		<updated>2024-09-10T22:44:34Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Lianyingzhao uploaded a new version of File:Select-image-f24.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-flavor-f24.jpg&amp;diff=24668</id>
		<title>File:Select-flavor-f24.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Select-flavor-f24.jpg&amp;diff=24668"/>
		<updated>2024-09-10T22:41:20Z</updated>

		<summary type="html">&lt;p&gt;Lianyingzhao: Lianyingzhao reverted File:Select-flavor-f24.jpg to an old version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lianyingzhao</name></author>
	</entry>
</feed>