3150 - Operating Systems
Eric Lo
0-Course Info
Why we have to learn OS?
• If you want to work for MS Windows, RedHat, Vmware,
VirtualBox
• If you want to work for Nvidia, HP
– Writing drivers
• If you want to work for Google, Facebook
– Interview Question: “Why the maximum file size in an USB
(FAT32) is 4GB?”
• If you want to be (or avoid) a hacker
• If you want to be a system administrator
– 20-80 system admin vs. programmer
– Who has a higher salary?!
• If you need to design a new system named vLLM
2
What’s an Operating System?
• Is your tiger mom
– Let you focus on your homework by freeing you about
• Scheduling
– Won’t conflict with your siblings
– Never waste your time
• Where your books are
• Many details behind
3
What’s an Operating System?
• Is a software
– Let you focus on your homework by freeing you about
• Scheduling
– Each application gets a CPU share
– Never waste your CPU
• Where your files are located on which “sector” your HD
• Many details behind
4
History of OS
• Before 1945
– Specialized purpose computer
• Program logic was hardwired in a computer
• 1945
– John von Neumann proposed a “stored-program”
general purpose computer
• A core set of instructions
– Instead of hardwired program
• Programs are formed by sequence of instructions
• Keep the programs in the storage
• Human Operators load that program from the storage and the
computer executes the instructions
http://www.osdata.com/kind/history.htm 5
Around 1950 – Batch System / Mainframe
– People submit programs
– Keep the programs in the storage
– Operating System loads those programs one-by-one
from the storage and the computer executes the
instructions
6
Early 1960s – Time Sharing
• The operating system gives each program in the
queue a time slice in a rotational manner
– Also introduce priority to jobs
• So that, to all users who have submitted jobs
– they all have progress
• instead of waited for 15 days and then halted by a bug
7
Early 1970s - UNIX
• A few newly hired engineers including Dennis
Ritchie and Ken Thompson at AT&T’s labs were
unable to use the expensive mainframe to do their
work because they were not senior enough
• Only given a PDP-7 machine that was okay for playing a game
called Space Travel
– US$72,000
– 9KB memory
• They developed their own OS for PDP-7
– UNICS
» Uniplexed Information and Computing Service
8
Early 1970s - UNIX
• AT&T agreed to release UNIX as an open source
operating system for academic use.
• Ken Thompson, one of the originators of UNIX and
C, took UNIX to the UC Berkeley
– Students loved it, improved it, leading to the world
famous Berkeley Standard Distribution (BSD) form of
UNIX
9
POSIX
• BSD UNIX quickly spread throughout the academic
world (because of free for educational)
• But after AT&T settled some lawsuit, it decided to stop
open-source
– Leading to several other UNIX which is free for educational
• E.g., FreeBSD, OpenBSD
• Afterwards, since so many UNIX variants available
– each had some subtle differences
– applications on top may not be portable to each different
UNIX
• So, IEEE developed a standard of UNIX:
– POSIX: defines a minimal system call interface that all UNIX-
claim system must conform to
10
>1974s – Personal Computer
• With the development of LSI (Large-Scale
Integration) circuit
– Price dropped
– Size dropped
• Intel 8080
– First general purpose 8-bit CPU
• In early 1980s, IBM made the first IBM PC
– Contacted Gary Kildall to make the OS
• Gary Kildall made the probably the worst business decision in
history
11
1980s
• Then IBM contacted Bill Gates
– who had made a BASIC interpreter
• bought DOS (Disk Operating System) from a Seattle Computer
company
• Grabbed the DOS developer to customize it
• Sold it to IBM as MS-DOS
12
1980s
13
1990s - Linux
• UNIX* was not free when not for educational
purpose
• In 1991, Linus Torvalds, a university student in
Finland, developed Linux without using any UNIX
code.
• Totally open license model
– Free even for commercial
14
C Sanity Check
• What’s the size of a pointer?
• Why there is .h (header file)?
• What’s the size of a char?
• What is the usage of static?
• What is a function pointer?
• What is the difference between declaring and defining a variable?
• What’s .DLL?
15
After this course, you shall know…
Why I get segmentation fault?
How can FBI (you) recover a file deleted by a
terrorist (and emptied the trash) on his
computer?
https://ahaslides.com/0LQ2X 16
Piazza
• Lecture notes, assignment, source codes demo during
the lectures, exercises, announcement…
– Discussion Board
• Healthy questions are welcome
– E.g., “why that can cause segmentation fault?”
• Unhealthy questions are discouraged
– E.g., “how many scores do I need in exam in order to pass?”
– E.g., Questions that come from skipping (or sleeping in / daydreaming
during) the lectures/lab
– E.g., Problems arise from you insist to test your assignments on Windows
– Private messages through Piazza
• No Email!
• Private Message usage example:
– Send us your answer of past mid-term/final for comments
• Private Questions that should be public get low/no priority
17
Assessment (tentative)
• Continuous Assessment (40%)
– 1 Warm-up Assignment A0 (1%)
– 3 Programming Assignments (24%; @8)
• A1: Shell (@8)
• A2: Multi-Thread Scheduler (@8)
• A3: File System (@8)
– 1 Mid-Term (15%; 20 Feb)
• Absence with strong justification (e.g., medical proof) will give you:
– CA: Final = 25 : 75 instead of 40 : 60
• Final (60%)
• 10% Bonus
– Bash Script (5%)
– To encourage student participation (5%)
• Your # of “endorsed answers” FYI:
# of Piazza’s ”endorsed answers”x 5% Last offering, 50 endorsed answers
18
Lab 1
Lab Users
linux> ls -l
Labs 2 – 3
Advanced users
#!/bin/bash
Labs 3 - 10
System Programmer
fork(), mmap()
Labs 8 – 13
Hacker, Kernel Level programmer, Google, ..
Lock-free programming, loop unrolling, Kernel I/O
19
Lab
Lab Programming Concept
Difficulty Difficulty
1 Linux *
2 More Linux (scripting) B * *
3 System Programming tool (e.g., make) * *
4 Process (fork, wait, exec, etc.) ** *
A1
5 Pipe and Signals ** *
6 Memory (Stack smashing attack) ***** ***
7 Threading ** **
A2
8 Synchronization I *** *****
9 File Systems A3 ***** **
10 Advanced C for Kernel Programming ***** ****
11 Memory Mapped I/O **** ****
12 Synchronization II ***** *****
13 Linux Kernel Hacking (Optional) ***** **
20
Why Linux?
21
Programming Assignments
• All test cases are given
• Grader is given
• No unseen test cases
• What scores you see (in our course VM) is what
you get
– So, test your program on our course VM before you ask
– So, incomplete/un-compilable code won’t get scores
22
Programming Assignment Deadlines
You actually
get instant
Assignment Deadline Late Penalty feedback from
A0 (Warm-up) 1% 23 Jan, 11am 100% our test suite
A1 (Shell) 8% 3 weeks after < Apr 24, 11am
A2 (Scheduler) 8% release 20%
>= Apr 24, 11am
A3 (File System) 8% 100%
B (Shell Script) 5% 3 weeks after 100%
release
– After Apr 24, 11am
• Absolute final deadline (*unless A3 is released late)
• TA will fetch from Gitclassroom
23
Reminder
• OS course is tough
– And it should be
– Programs must pass test cases to gain scores
• Suggestion: don’t take too many major when you
take this course
• Exam cover EVERYTHING in this course
24
Use of AI in the assignments
• Allowed AI tools
– Any AI model, e.g. GPT-4o, that causes no ethical issues.
• Acknowledge your use of AI tools in
ai_declaration.txt
25
Acknowledgement, References, and Disclaimer
• Source codes on the notes, mid-term, exam are
mostly pseudocode
– Not directly compliable
• Some notes and examples are extracted from Dr. TY
Wong’s previous offering
• Google Images, Stackoverflow
26
Reference
• Google / Youtube
• GPT!
• Past mid-term (with answers) and finals are given
– Note: the schedule/content of each term varies, so just
take those as a reference only
It helps a lot if you switch to use Linux
as your main OS (instead of via a VM),
at least during this course
27