Part of
Operating Systems in Three Easy Pieces
I. A Dialogue on the Book
Key Ideas
-
Virtualization
-
Concurrency
-
Persistence
II. Intro to Operating Systems
Key Ideas
-
How to virtualize resources?
- What mechanisms and policies are implemented by the OS to attain virtualization?
- How does the OS do so efficiently?
- What hardware support is needed?
-
How to build correct concurrent programs?
- When there are many concurrently executing threads within the same memory space, how can we build a correctly working program?
- What primitives are needed from the OS?
- What mechanisms should be provided by the hardware?
- How can we use them to solve the problems of concurrency?
-
How to store data persistently?
-
What techniques are needed to do so correctly? What mechanisms and policies are required to do so with high performance? How is reliability achieved, in the face of failures in hardware and software?
Definitions
-
-
Virtualization
-
The OS takes a physical resources (processor, memory, disk) and transforms it into a more general, powerful, and easy-to-use virtual form of itself ⇒ virtual machine
-
Typical OS exports a few hundred system calls to APIs and provides a standard library to applications
Von Neumann
The processor fetches an instruction from memory, decodes it, and executes it. This continues until the program completes.
Notes
-
-
OS ⇒ resource manager
-
each of the CPU, memory, and disk is a resource of the system
Virtualizing the CPU
#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <assert.h> #include "common.h"
-
int main(int argc, char *argv[])
{
if(argc != 2) {
fprintf(stderr, "usage: cpu <string>\n");
exit(1);
}
char *str = argv[1];
while (1) {
Spin(1);
printf("%s\n", str);
}
return 0;
}- Turning a single CPU into an infinite number of CPUs and thus allowing many programs to seemingly run at once ⇒ virtualizing the CPU
Concurrency
Persistence
Design Goals
- Abstractions
- High Performance ⇒ minimize the overheads of the OS
- Provide protection between applications
- Isolation ⇒ isolating processes from one another is the key to protection
- Operating systems strive to provide a high degree of reliability
- Energy-efficiency
- Security
- Mobility
History
References
-
Brinch Hansen
-
Early operating systems were just a set of libraries of commonly-used functions.
-
Batch Processing
-
System Call pioneered by the Atlas computing System ⇒ added a special pair of hardware instructions and hardware state to make the transition into the OS a more formal, controlled process
- System Call vs. Procedure Call
Part 2