Introduction to OS Flashcards

1
Q

What are the two main functions of an operating system?

A


Abstraction: Makes hardware easier to use by providing simpler interfaces than direct hardware manipulation.

Resource Management: Allocates and manages hardware resources (CPU, memory, disk space) among different programs to ensure fair and efficient usage.

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

Describe the two modes of CPU operation and what runs in each mode.

A


Kernel Mode: The privileged mode where the operating system runs. It has full access to hardware and can execute special instructions.

User Mode: The less privileged mode where applications run. It has restricted access to prevent potentially harmful operations.

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

How does a program switch from user mode to kernel mode?

A


System Calls: Provide a controlled mechanism for programs to request services from the OS.

Traps: Occur when the CPU encounters an error (e.g., divide by zero) or an attempt to execute a privileged instruction in user mode, triggering a switch to kernel mode.

Interrupts: Generated by hardware devices to signal events to the OS (e.g., a network packet arrived).

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

What is the difference between a system call and the Kernel API?

A


System Calls: The direct interface between user programs and the OS kernel, usually involving low-level assembly instructions.

Kernel API: A set of functions that provide a higher-level interface to system calls, making it easier for programmers to interact with the OS. The Kernel API handles the details of setting up system call arguments and executing the necessary instructions

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

What role does a language library like libc play in interacting with the OS?

A


Language libraries provide an even higher level of abstraction on top of the Kernel API.

For example, the C standard library (libc) includes functions like printf and fopen which ultimately rely on system calls for their functionality, but programmers don’t need to interact with system calls directly.

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

Compare and contrast monolithic operating systems and microkernels.

A


Monolithic OS: Most OS components run within the kernel space, leading to potentially large and complex kernels. This is the most common OS architecture.

Microkernel: Aims for a minimal kernel, with most OS services running as user-space servers. This theoretically improves modularity and fault isolation, but it hasn’t been commercially successful except in niches like embedded systems.

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