Part 1 Flashcards

1
Q

What are the key roles of an operating system?

A

Hides hardware complexity, manages resources, provides isolation & protection between applications running on the OS

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

distinction between OS abstractions, mechanisms, policies

A

Abstractions are essentially complicated interactions between the OS and hardware that the OS makes simpler for applications running on a system.

“For example, applications development deals with abstractions like processes, threads, files, memory pages, instead of having to care about things like memory layout, disk sectors, and so on.” - Moustafa Attia

Mechanisms are the “verbs’ that describe actions an operating system can do on abstractions, like “create”, “schedule”, “open”, “write”, “allocate”.

Policies are concepts implemented by Operating systems to efficiently deal with the nature of computer hardware and software interaction. For example the operating system can have a policy about how long content can stay in memory instead of just being on disk.

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

principle of separation of mechanism and policy

A

Mechanisms in the operating system can support multiple policies. The mechanisms are flexible. The memory management mechanism might use different policies depending on the situation (LRU, LFU, random, etc.)

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

What does the principle optimize for the common case mean?

A

This means designing the OS based on how it will be used, what the user will be executing, what are the workload requirements of the user. Optimizing the OS with these things in mind is important because it allows the OS to be as effective as possible. Specifically it entails the OS choosing specific mechanisms and policies that match its most common usage.

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

What happens during a user-kernel mode crossing

A

When a user application/process tries to execute a function that requires kernel level permissions the call (system call) is sent across the user-kernel boundary. The kernel performs the system call and then returns to the user process. During the time when in privileged mode a bit is set on the CPU which allows privileged calls to be performed, this bit is not set when in user mode. A trap can also occur when a user-level process attempts to perform a privileged function, the operating system will then check if the calling process should be allowed to do that action or not.

“(I they key point in user-kernel mode crossing is that the mode bit is set in CPU, and control is passed to kernel)” - Moustafa Attia

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

What are some of the reasons why user-kernel mode crossing happens?

A

User-kernel mode crossings happen when a user-level thread/process/applications attempts to do a privileged action while the OS is not operating in privileged mode causing a trap OR when a user-level thread/process makes use of the OS level provided system calls which have the operating system perform said privileged actions.

“(I also think that signals are user-kernel mode crossing but in the other direction: from kernel to user)” - Moustafa Attia

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

What is a kernel trap? Why does it happen? What are the steps that take place during a kernel trap?

A

A kernel trap is a sort of alert to the operating system that an unprivileged user process has attempted to perform a privileged task or access privileged memory addresses. When this occurs the OS determines the source of this trap, determines if it should be allowed or not and then after returning execution to the interrupted user process.

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

What is a system call? How does it happen? What are the steps that take place during a system call?

A

A system call is an operation (belonging to a set) that the OS makes available to applications which can explicitly invoke a privileged mechanism. This happens when a user-level application makes a system call telling the OS it would like it to perform said privileged action.

The steps involved are:

User Process makes a system call
Control is passed to the operating system which sets the kernel mode bit to 0 (privileged access only). It jumps to the place in memory for the OS function to take place (along with the optional arguments from the user process.
The system call completes execution and returns the result to the original user process which requires an execution context switch back to user-level privilege.

There are both synchronous and asynchronous versions of system calls.

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

Contrast the design decisions and performance tradeoffs among monolithic, modular and microkernel-based OS designs?

A

Monolithic operating system design is large and can be hard to manage and may not be very portable, but it can be optimized at compile time since it includes everything a system will need.
Modular operating system design can be smaller than monolithic because it is interface implemented oriented - meaning modules that are required based on the usage and workload of the operating system can be loaded in if they are necessary and excluded if not. It’s less resource intensive and is easier to maintain; however, performance is impacted because of interfaces and modules are often sources of bugs which are not directly the fault of the operating system implementing said modules.
Microkernel operating system design has a very small footprint and only supports very basic roles. Memory management, address pace, location for execution of user processes. The user-level runs the typical operating system components like file systems, disk drivers, etc. This requires much less inter-process interactions. It is very small and test (useful for embedded devices). It is often less portable (very specific for said devices) and could be slow because of number of user-kernel boundary crossings that are required.

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