Agenda

Why do we need an OS?

Question: What would programming look like without an OS?

What does an OS do?

What is an operating system?

Dictionary definition:

The software that supports a computer’s basic functions, such as scheduling tasks, executing applications, and controlling peripherals.

So the OS runs processes and access hardware:

Problem: CPU, memory, and I/O devices are limited resources

For CPU and Memory, the OS’s solution is to virtualize them.

For I/O devices, an OS may mediate access via abstract interfaces, rather than provide the virtualization

I/O devices also enable persistence (i.e. non-volatile storage)

Primary OS responsibilities

Secondary concerns?

Processes can run at the same time whle sharing system resources

Software attack vectors:

Software mechanisms:

Common approach to approach this from hardware are “rings” of protection:

How to modify CPL?

Q: Ok to allow the user directly modify CPL before calling OS? A: No, the user can set CPL to 0 and run arbitrary code

Q: What about combining CPL “set instruction with”jump" instruction to force instruction pointer change? A: No, user can jump into their code

Q: Ok, how about they have to jump into the OS? A: No, they can jump to anywhere in the OS

Tight integration of software & hardware permits safe, controlled jumps between running user/OS code

Isolation is possible, but what code is run in user mode? What code is run in kernel mode?

How is an OS organized?

What are the top-level modules of an OS which must run in privileged/kernel mode?

“Standard” OS modules:

Privileged modules constitute the “core” of the operating system; i.e., the OS kernel.

Simple approach: all of them are privileged

Alternative approach: minimum privilege