1/27
Flashcards covering the role of the OS, hardware virtualization, system calls, process creation, memory protection, I/O, interrupts, caching, and related hardware concepts.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the primary role of the OS with respect to applications and hardware?
To serve as a layer that separates applications from hardware and virtualizes hardware resources, providing a safe, consistent interface for program execution.
Why would running programs directly on hardware be problematic (no OS) according to the notes?
Applications would be less portable and harder to adapt to different hardware; they would need to know how to talk to specific hardware, creating complexity and potential security vulnerabilities.
How does virtualization of hardware benefit applications, as described in the notes?
The OS turns hardware into virtualized resources that are easier to use, shareable by many programs, and provide a consistent interface across different hardware, enabling abstractions like a file system.
What does the OS interface to applications primarily consist of?
A collection of system calls (e.g., read, write) that request services from the OS.
How do C programs typically interact with the OS for I/O, according to the notes?
Through the C standard library, which may eventually invoke OS system calls.
What is a system call?
A low-level interface that allows a program to request services from the OS by transferring control to the kernel.
What is a file descriptor in Unix/POSIX?
An integer handle returned by open() used by read(), write(), and close() to access a file.
Name the three Unix/POSIX system calls commonly used to read a file and their roles.
open() to obtain a file descriptor, read() to read bytes into a buffer, close() to release the descriptor.
What command-line tool can show all system calls made by a program?
strace, e.g., strace ./readFile.
What does fork() do in Unix/POSIX?
Creates a new child process that is a copy of the parent; both can run concurrently.
What does exec*() accomplish in the Unix/POSIX process model?
Replaces the currently running program with a different program, usually after a fork.
What is the purpose of wait() in Unix/POSIX?
Makes the parent wait for one of its child processes to terminate.
Can the parent and child processes run concurrently, and how?
Yes, they can run concurrently on a single CPU by taking turns, or in parallel on multiple CPUs.
List some typical system calls for running programs mentioned in the notes.
Reading and writing files, starting other programs, allocating/configuring memory, inter-process communication, monitoring the system state.
What is dual-mode operation in CPUs?
The CPU can run in kernel mode (privileged) or user mode (restricted); kernel mode has access to privileged instructions.
What are base and limit registers used for in memory protection?
They define a contiguous memory region that a user process can access; hardware checks every memory access against this region.
What is a timer interrupt and why is it important?
An interrupt generated by a countdown timer that ensures the CPU returns to the kernel, enabling multitasking and responsiveness.
How do interrupts work in general?
When an interrupt occurs, the CPU suspends the current instruction sequence and jumps to an interrupt handler via an interrupt vector.
What is Direct Memory Access (DMA) and its benefit?
DMA allows device controllers to transfer bulk data directly to memory, reducing CPU involvement; requires bus arbitration.
What are Port-Mapped I/O and Memory-Mapped I/O?
Port-Mapped I/O uses special I/O instructions to access device registers; Memory-Mapped I/O uses regular memory instructions to access device registers in a reserved memory region.
Why is I/O protection important and how is it achieved for memory-mapped I/O?
The OS must ensure I/O requests come through system calls; memory protection is needed to prevent devices or memory regions from being misused.
What is the purpose of memory protection in the OS?
To control which memory a program can access, prevent programs from interfering with the kernel or other processes, and protect kernel memory.
Describe the base/limit memory-protection mechanism in brief.
Base holds the starting address and limit holds the size; hardware checks each access to ensure it lies within the allowed region, with privileged instructions to modify them.
What is the role of the interrupt vector?
A table of pointers to interrupt handlers, enabling dispatch to the correct handler for each interrupt type.
What is the Von Neumann architecture as described in the notes?
Code and data reside in main memory; the CPU fetches and executes instructions from memory.
Why is caching important in memory hierarchies?
Caches exploit temporal and spatial locality to speed up memory access by storing a subset of data closer to the CPU, reducing latency.
How does the OS interact with device controllers for I/O?
The CPU communicates with device controllers via device registers on the controllers and the system bus; the OS can manage I/O using interrupts or DMA.
What is the overall takeaway of the lecture notes?
Understanding the role of the OS, basic computer organization (memory hierarchy, caching, I/O, interrupts), and hardware protection mechanisms.