CS6200 Flashcards

1
Q

What is an operating system?

A

A special piece of software that abstracts and arbitrates the use of a computer system.

It’s a layer of systems software that:
* directly has privileged access to the underlying hardware
* hides the hardware complexity
* manages hardware on behalf of one or more applications according to some predefined policies
* in addition, it ensures that applications are isolated and protected from one another

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

____ operates in kernel mode to access underlying hardware.

A

The operating system

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

____ operates in user level mode

A

Application software

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

T/F? kernel-level mode and user-level mode are supported by hardware

A

True

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

Attempts to directly access hardware by software running in user-level mode can activate a ____ which interrupts the program and hands control to the OS to determine if it should get access

A

trap

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

Applications can use _____ to interact with underlying hardware

A

System calls

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

T/F? User/Kernel transitions have a negligent impact on the performance of applications

A

No, it can have an impact on cache hit frequency after the transition

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

What are some benefits of a monolithic OS?

A

* Everything is included
* You can use inlining and compile-time optimizations

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

What are some drawbacks of a Monolithic OS?

A

* customization is harder
* portability is harder
* manageability is harder
* larger memory footprint
* harder to optimize performance for different use cases (e.g. using different file systems for different access patterns)

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

Is linux a monolithic, modular, or microkernel os?

A

Modular

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

What are benefits of a modular OS?

A

* Easier to maintain and upgrade
* Smaller footprint
* Less resource needs

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

What are the drawbacks of a modular OS?

A

* indirection can impact performance
* maintenance can still be an issue, because modules can introduce bugs

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

In a microkernel, system services like the filesystem and disk driver run in ____ level

A

User level (as opposed to privileged)

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

What are the benefits of a microkernel?

A

* Small size
* Easy to verify because it’s small

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

What are the downsides of a microkernel?

A

* Poor portability, typically customized for target hardware
* More complex to develop software for
* Cost of user/kernel transitions

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

What is a process?

A

An executing program

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

What is the difference between an application and a process?

A

Application is a program on disk (static entity), whereas a process is a program that has been loaded in memory and is in the state of execution (active entity).

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

What does a process store in memory?

A
  • Stack
  • Heap
  • Data
  • Text
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is “address space”?

A

The “in memory” representation of a process.

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

What are “virtual addresses”?

A

The abstracted addresses used by a process.

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

What are “physical addresses”?

A

The actual physical locations in memory.

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

Where is the mapping of virtual addresses to physical addresses stored?

A

In the Page Table

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

How does an OS keep track of the state of a process?

A

Via the Process Control Block

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

A Process Control Block contains the state of CPU registers. Since register contents can change much faster than they can be updated in memory (where the PCB is stored), how does the OS make sure those are updated for later use?

A

By setting the values in the PCB when stopping the process on the CPU.

This is called a context switch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a “context switch”?
Switching the CPU from the context of one process to the context of another.
26
Is a context switch computationally expensive?
Yes. It takes CPU cycles to store the old context and load the new one, and caches on the CPU become invalid for the new process.
27
What states can a process be in?
* New * Ready * Running * Waiting * Terminated
28
What state does a process start in?
New
29
What state does a process end in?
Terminated
30
How does a process transition from New to Ready state?
Admitted
31
How does a process transition from Ready to Running state?
A scheduler dispatch
32
How does a process transition from Running to Ready state?
An interrupt
33
How does a process transition from Running to Waiting state?
I/O or event wait
34
How does a process transition from Waiting to Ready state?
I/O or event completion
35
How does a process transition from Running to Terminated state?
It Exits
36
The CPU is able to execute a process when it is in which states?
Running or Ready
37
How are new processes created?
They are spawned by a parent process (via fork or exec)
38
What is the “fork” mechanism for process creation?
Copying the parent Process Control Block into the new child PCB, where the child continues execution at the instruction after the fork.
39
What is the “exec” mechanism for process creation?
Creates a new process control block, loads a new program, and starts from the first instruction.
40
On unix-based OS, which process is “the parent of all processes”?
init
41
On Android, which process is “the parent of all app processes”?
ZYGOTE
42
What is the role of the CPU scheduler?
It determines which one of the currently running processes will be dispatched to the CPU to start running, and how long it should run for.
43
In the context of process scheduling, an OS can “preempt”. What does that mean?
It can interrupt and save current context
44
In the context of process scheduling, an OS can “schedule”. What does that mean?
It can run the scheduler to choose the next process
45
In the context of process scheduling, an OS can “dispatch”. What does that mean?
It can dispatch the process and switch into its context
46
If a process scheduler is run more frequently, ___ goes down.
Useful CPU work Useful CPU work = non-scheduler Processing Time / Total Time
47
In the context of process scheduling, what is “timeslice”?
Time allocated to a process on the CPU
48
What are some ways a process can end up on the ready queue?
* I/O request * Time slice expired * Fork a child * Wait for an interrupt
49
What do Inter-Process Communication (IPC) mechanisms do?
* Transfer data/info between address spaces * Maintain protection and isolation * Provide flexibility and performance
50
What is message-passing IPC (interprocess communication)?
OS manages a messaging channel, which process can write to and read from.
51
What is the shared memory IPC (interprocess communcation) mechanism?
* OS sets up a shared memory channel, and maps it into each process address space
52
What advantage does shared memory IPC have over message passing IPC?
Less overhead, OS is out of the way
53
What is the advantage of message-processing IPC over shared memory IPC?
How to use the shared memory isn't defined by the OS, so it becomes easier to write a bug in code that uses it, and that code might have to be duplicated between different applications.
54
If we want a process to be able to execute on multiple CPUs, we must use \_\_\_\_
Threads
55
Do threads have the same virtual→physical memory mapping? (shared page tables)
Yes
56
What benefits do threads provide?
* Parallelization * Specialization - can dedicate threads to specific tasks, CPU cache can maintain more valid entries in each core, and prioritization can be used
57
Why use threads rather than just having different processes?
Less overhead. We don't have to allocate memory for each thread. Communication between processes is more complicated.
58
Are threads useful on a single CPU?
Yes. It can work on another thread during long I/O operations.
59
When two threads try to access the same memory value at once, it is a ____ \_\_\_\_ problem
data race
60
\_\_\_\_ ____ ensures that only one thread has access to a memory value at a time
mutual exclusion
61
When one thread is waiting on a specific condition to proceed, and will be notified by another thread, it is using a ____ \_\_\_\_
condition variable
62
Condition Variables and Mutex are both ____ mechanisms
synchronization
63
In Birrell's paper, what call is used to create a new thread?
fork(proc, args)
64
In Birrell's paper, what do the params to fork(proc, args) mean?
proc = program counter args = input parameters
65
In Birrell's paper, what call is used to terminate a thread?
join(thread)
66
In Birrell's paper, what does join(c\_thread) do?
It blocks the calling thread until child thread “c\_thread” finishes
67
If a thread cannot acquire a mutex, it is \_\_\_\_
blocked
68
In Birrell's paper, a lock uses a mutex to prevent a ____ \_\_\_\_ from being executed by more than one thread at once.
Critical Section
69
In the context of threads, what is a “spurious wakeup”?
When a thread is woken up, but it still cannot proceed.
70
In the context of threads, what is a deadlock?
Two or more competing threads are waiting on each other to complete, but none of them ever do.
71
In the context of threads, it prevents ____ \_\_\_\_ to maintain the same order in which mutexes are locked.
Dead lock
72
What are the possible ways of dealing with deadlocks?
* Prevention - maintain a lock order - expensive, can limit performance * Rollback - Return to an execution state before the deadlock - not always possible, also can be expensive * Do nothing - just reboot the software if one occurs
73
What are the benefits of the one-to-one model of kernel and user threads?
OS sees/understands threads, synchronization, blocking…
74
What are the drawbacks of the one-to-one model of kernel and user threads?
Must go to kernel space for all operations (which has a cost) OS may have limits on policies and thread count Since thread management happens at the kernel level, it can affect portability of apps between different OS
75
In the many-to-one model of user/kernel threads, which user-level thread is mapped to the kernel level thread is managed at the ____ level
user
76
What are the benefits of the many-to-one model of user/kernel threads?
Easy to port apps – they don't depend on OS specific limits or policies
77
What are the drawbacks of the many-to-one model of user/kernel threads?
OS has no insights into application needs OS may block entire process if one user-level thread blocks on I/O
78
What are bound/unbound threads in the context of the many-to-many model of user/kernel threads?
Bound user threads are associated to just one kernel thread
79
What are the benefits of the many-to-many model of user/kernel threads?
Can avoid problems of one-to-one or many-to-one
80
What are the drawbacks of the many-to-many model of user/kernel threads?
Requires coordination between user and kernel level thread managers
81
What is the boss-workers thread pattern?
Boss assigns work, workers perform the tasks
82
In the boss-worker thread pattern, how does the boss assign tasks to the workers?
Generally with a queue. Although it requires synchronization among the workers to avoid picking up the same task, it has less of a performance impact than using the boss process to keep track of which workers are busy.
83
What are some benefits of specialized workers in the boss-worker thread pattern?
Better locality – more cache hits QoS management is possible
84
What is the pipeline thread pattern?
Threads assigned one subtask Entire tasks are pipelines of subtask threads Multiple tasks can go through the pipeline at different stages
85
What is the layered thread pattern?
Layers are groups of related subtasks end-to-end task must pass through all the layers Like pipeline, but not linear – some threadpools can handle multiple subtasks