4 - Interrupts, Traps, Kernel Design, VMs Flashcards

1
Q

At a LOW level, how do we write programs that interact with devices?

A

Special I/O instructions

Memory mapped devices

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

At a HIGH level, how do we write programs that interact with devices?

A

System calls provided by OS

There are blocking and non blocking versions of system calls

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

What is I/O busy waiting/spinning/busy looping?

A

CPU repeatedly checks if device is ready

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

What are some problems with busy waiting?

A

CPU is tied up while the slow I/O completes the operation

We are wasting power and generating heat (so what?)

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

What is I/O busy waiting with delay?

A

same as busy waiting, we just add a short delay to reduce CPU usage
CPU can do other things while program is sleeping

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

What are some problems with busy waiting?

A
  • hard to estimate the right amount of sleep

* program might end up running longer than necessary

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

What are interrupts?

A

A mechanism to let the CPU know something ‘important’ happened
When the I/O device finishes the operation, it generates an interrupt,
letting the CPU know it’s done, or if there was an error

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

How is an interrupt handled?

A

Usually handled immediately
the CPU temporarily suspends its current activity (saves state)
The CPU then executes an ISR
- The CPU puts itself in a kernel mode (privileged mode)
- Which routine[s] gets executed is configured by OS
Eventually CPU restores the saved state and resumes original execution

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

What is an Interrupt Vector Table?

A

Each interrupt contains an address of a service routine

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

What are the two different types if interrupt?

A

Hardware & Software Interrupts

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

What are Hardware Interrupts?

A

The source of the interrupt is another device

Interrupts are UNPREDICATABLE

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

What are Software Interrupts? (exceptions/traps?)

A

Source of interrupt is CPU itself

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

What are the two types of software interrupt?

A

Intentional and unintentional

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

What are Unintentional software Interrupts?

A

EXCEPTIONS

occurs when CPU executes ‘invalid’ instruction

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

What are Intentional software Interrupts?

A

TRAPS
the purpose is to execute predefined routine in kernel mode
operating systems use traps to implement system calls

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

Differences between hardware and software interrupts?

A
Hardware Interrupts:
• external event delivered to the CPU
• origins: I/O, timer, user input, ...
• asynchronous with the current
activity of the CPU
• the time of the event is not known
and is not predictable
Software Interrupts:
• internal events, eg. system calls,
error conditions (div by zero)
• synchronous with the current activity of
the CPU
• occurs as a result of execution
of a machine instruction
17
Q

Similarities between hardware and software interrupts?

A

put the CPU in a kernel mode
save the current state of the CPU
invoke a kernel routine, defined by the OS
resume the original operations when done, restoring user mode

18
Q

What are the limits of interrupts?

A

Many small interrupts is inefficient

19
Q

What is DMA?

A

Direct Memory Access
• DMA absorbs most interrupts
• DMA can save data directly into memory, without CPU even knowing
• result is less interrupts for CPU

20
Q

What is the important trade-off when considering what to put in the kernel?

A

Stability vs. speed

Kernel code is faster but more bug prone

21
Q

What is a monolithic kernel design?

A

the entire OS runs as a single program in kernel mode

fastest, but harder to port, more prone to bugs, potentially less stable

22
Q

What is a microkernel?

A

only essential components in kernel ― running in kernel mode
• essential = code that must run in kernel mode
• the rest is implemented in user mode
• less bugs, easier to port, easier to extend, more stable, but slower

23
Q

What is a hybrid kernel?

A

• trying to balance the cons/pros of monolithic kernels and microkernels

24
Q

What does IPC stand for?

A

Inter-process communication?

25
Q

What are Kernel Modules?

A

A type of hybrid kernel
Base is a small kernel with essential components, with dynamically loadable kernel parts (modules)
Drivers are often implemented as modules

26
Q

When are kernel modules loaded?

A

Boot time

Later - e.g., when user plugs in USB device

27
Q

What are some disadvantages to the layered approach in kernel design?

A

Hard to define layers
Less efficient
Not all problems can be adapted to layers

28
Q

MAC OSX is a hybrid kernel

True or False?

A

True - XNU

29
Q

GNU/Linux kernel is a hybrid kernel

True or False?

A

Technically false, but does have some layers and dynamically loadable modules

30
Q

Win NT kernel is hybrid

True or False?

A

True

31
Q

What is a VM?

A

Virtual Machine

Emulate computer systems

32
Q

What is a Hypervisor?

A

Software or Hardware that manages VMs

33
Q

What are the three different types of hypervisor

A

Bare-metal - Runs directly on hardware - fastest (VMWare)
Hosted - Runs on top of another OS - slower (VMWare, Virtual Box)
Hybrid - eg. Linux kernel can function as a hypervisor
through a KVM module

34
Q

What is OS Virtualization? Examples?

A

The use of software to allow system hardware to run multiple instances of different operating systems concurrently.

35
Q

What are three benefits of VMs?

A
Host system is protected from the VMs
VMs are isolated from eachother
Multiple different OSs can be running on the same computer concurrently
Can save state
System consolidation - Cost effective
36
Q

Why do modern OSs move away from the standard monolithic

system structure?

A

Slow boot
Error prone
Harder to port