MIDTERMS Flashcards

1
Q

What are the three key roles of an operating system? Briefly describe each role.

A

Referee: Manages and arbitrates access to shared resources like CPU, memory, and I/O devices among competing processes.
Illusionist: Provides an abstraction of the underlying hardware, presenting a simpler and more convenient interface to applications (e.g., virtual memory, file systems).
Glue: Offers common services used by applications, such as networking, windowing systems, and security features.

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

What is the difference between a thread and a process?

A

A process is a self-contained execution environment with its own address space and resources. A thread is a lightweight unit of execution that exists within a process and shares its resources, including the address space.

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

Explain the concept of dual-mode operation in operating systems.

A

Allows the OS to run in two distinct modes: user mode (for normal applications) and kernel mode (privileged mode for the OS core). This separation protects the OS from malicious or faulty user programs.

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

What is an address space and why is address space translation important in OS design?

A

An address space is the set of addresses a process can access. Address space translation maps these logical addresses to physical memory addresses, providing isolation between processes and protection for the OS.

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

Describe the base and bound protection mechanism.

A

A simple protection scheme where each process is given a base address (start of its allocated memory) and a bound (maximum size). The hardware ensures the process cannot access memory outside these limits.

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

What are the three main methods for transitioning from user mode to kernel mode?

A

System Calls (Syscalls): Triggered by software when a user process needs to access a privileged kernel function.
Interrupts: Hardware-generated signals that notify the OS of external events (e.g., I/O completion, timer).
Traps/Exceptions: Software-generated interrupts caused by errors or exceptional conditions during program execution (e.g., division by zero).

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

What is a process control block (PCB) and what information does it typically contain?

A

Process Control Block (PCB): Data structure used by the kernel to maintain information about each process:
Process ID (PID)
Process State (running, ready, blocked)
Process Priority
Memory and Resources allocated to the process.

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

What is the purpose of the fork() system call in UNIX-like operating systems?

A

creates a child process that is a near-identical copy of the parent process, inheriting its memory and resources.

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

How does the OS leverage DMA (Direct Memory Access) for I/O operations?

A

DMA allows I/O devices to transfer data directly to or from main memory without involving the CPU. This offloads the CPU from handling I/O data transfers, improving system performance.

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

What are the main differences between the “r”, “w”, and “a” modes when opening a file in C?

A

“r”: Opens a file for reading only. An error occurs if the file does not exist.
“w”: Opens a file for writing only. If the file exists, it is truncated to zero length; otherwise, a new file is created.
“a”: Opens a file for appending. Output is written to the end of the file. If the file does not exist, it is created.

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