Introduction to Operating Systems


What happens when a computer program run?


Why do we need OS?


How do the OS help (1)?

This is possible due to virtualization.


How do the OS help (2)?

Hands-on: Getting started

1
2
cd ~/ostep-code/intro
make

Hands-on: CPU Virtualization

CPU limit

In docker-compose.yml, the amount of cpus made available to the containers are only 2:

1
2
3
4
deploy:
  resources:
    limits:
      cpus: 2.0
1
./cpu A & ./cpu B & ./cpu C &./cpu D 
1
ps aux | grep cpu
The illusion of infinite CPU resources

Hands-on: Memory Virtualization

1
2
3
clear
sudo setarch `uname -m` -R /bin/bash
./mem 100 &./mem 200
Do programs running concurrently occupy the same memory locations (addresses)?

No

The illusion of dedicated memory resources

Concurrency

1
2
3
./threads 50
./threads 100
./threads 200
1
2
3
4
./threads 20000
./threads 30000
./threads 30000
./threads 30000
Problem with concurrency
Why does this happen?

Persistency


A brief history of operating system research and development

A good paper to read: Hanser, Per Brinch. “The evolution of oeprating systems” 2001