Week 1 Flashcards

1
Q

What does an OS do?

A

Virtualize resources, so every process can have the illusion of a dedicated machine.

Mange I/O so multiple processes can access devices (disk, network card, etc.). concurrently without interfering

Make the above easy - define simple unambiguous interfaces (syscalls).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What were computers like in the early 1950s?

A

Were used for scientific computing and processing large datasets

Batch mode: submit a large computation,
wait for result, submit another one

Basically a very powerful calculator used by one operator at a time - no need for OS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What did early machines have (1950s) that is now consider part of any OS.

A

Libraries of functions. The reason was convenience.

Still no virtualization (one program at a time). No mediation (any program could still do whatever they wanted).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What were computers like in the 1960s?

A

There was separation. There was an idea to give the CPU two execution modes:

An unprivileged mode and a privileged mode.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do we implement separation? How do we switch between the two modes?

A

The CPU defines some type of trap. An instruction to switch into OS code and back.

The app can pass execution and parameters to the OS, but cannot define the code that the OS is going to execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In separation there is the concept of the ring of fire. What are rings 0-3 used for?

A

Ring 0 (Most privileged) - Kernel
Ring 1 - Device Drivers
Ring 2 - Device Drivers
Ring 3 (Least privileged) - Applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or false. The OS will allow multiple processes to write to the disk without coordination.

A

This is false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What was programming like in the 1970s?

A

Many processing tasks were still I/O bound

There was the introduction of multiprogramming which meant that you could let multiple processes run at the same time and switch between them when appropriate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do we enable multiprogramming?

A

There are several things but the most important thing is memory protection.

The solution to this is virtual memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What did UNIX provide as an OS?

A

UNIX was the first widely available OS which implemented storage (file system), time sharing (splitting CPU time), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What were computers like in the 1980s?

A

Companies like IBM and Apple started selling PCs.

PCs shipped with very simple OS’es which lacked proper protection and multiprogramming capabilities.

Example: MS DOS had no memory protection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are computers like 1990s to today?

A

OSes improved from the 90s.

They now had true memory protection capabilities.

True multiprocessing/threading (the OS controls how processes share the CPU).

Robust, performant file systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is CPU virtualization?

A

This is when we “slice” a CPU

An OS needs to be able to run a program, and stop a program. It should decide which program should run at any given time.

Means that we divide CPU time across programs fairly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is memory virtualization.

A

When we give every process the same virtual address space.

In other words each process gets the illusion of having memory to itself.

Mapping between virtual and physical pages can change.

Mapping is not necessarily 1:1. Resources are used by multiple processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How is concurrency different from sharing CPU?

A

CPU virtualization just means that multiple processes can share the CPU.

However in concurrency, different parts of your program cooperate to complete a task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the requirements for concurrency?

A

The ability for different parts of the program to communicate.

The ability to synchronize access to shared data.

17
Q

What are two forms that a concurrent program can take?

A

Different communicating processes (separate address spaces)

Threads within the same process (shared address space).

18
Q

What do the following do?
pthread_create()
pthread_join()

A

pthread_create(): creates a new execution threads, pass the execution to a specified function.

pthread_join(): wait until a specified thread terminates.

19
Q

What is persistence?

A

Processes typically need to receive some pre-existing inputs and save some outputs

This is accomplished using persistent storage (disks, SSD)

No virtualization abstraction (it does not make sense to give each program the
abstraction of a “dedicated disk”, as programs often share data)

Instead, shared disk using files and directories (folders) abstraction

20
Q

What are the differences between virtual memory and the shared disk?

A

Virtual memory: works because processes mostly need their own memory space, and only occasionally need to share memory data

Shared disk: works because it is very common for programs to use or share disk data.