Kernel data structure Flashcards
(20 cards)
What is a kernel data structure?
It’s a data structure used by the OS kernel to manage system resources like processes, memory, files, and devices.
Why are kernel data structures important?
They let the kernel efficiently track, manage, and control system operations like scheduling, memory use, and device access.
Where are kernel data structures stored?
In kernel space, which is protected from user access for security and stability.
Name 4 key types of kernel data structures.
Process Control Block (PCB), Page Tables, File Descriptor Tables, Scheduler Queues.
What is a Process Control Block (PCB)?
A data structure that stores information about a process, such as its ID, state, registers, memory, and scheduling info.
What kind of information is stored in a PCB?
Process ID, process state, CPU registers, memory pointers, priority, I/O status.
When is a PCB created and destroyed?
Created when a process starts, and destroyed when the process terminates.
What is a page table in the OS kernel?
A data structure that maps virtual memory addresses to physical memory addresses.
Why are page tables necessary?
They allow the OS to implement virtual memory and isolate process memory spaces.
What happens if a page table entry is missing?
A page fault occurs, and the OS may load the missing page from disk into RAM.
What is a file descriptor table?
A data structure that maps open files to file descriptors for each process.
Who maintains the file descriptor table?
Each process has its own table, but the kernel maintains the actual file structures.
What happens when a file is opened?
The kernel assigns a file descriptor and adds an entry to the file descriptor table.
What are scheduler queues?
Kernel data structures that organize processes based on their state (e.g., ready, waiting).
What types of scheduler queues exist?
Ready queue, waiting queue, and device queues.
How does the scheduler use these queues?
To select the next process to run based on the scheduling algorithm.
What is a device table?
A structure used by the kernel to manage hardware devices and their drivers.
What does the device table store?
Information about device status, device IDs, and associated drivers.
What’s the difference between kernel data structures and user-space data structures?
Kernel structures manage system-level operations and are protected; user-space structures are used by applications and have no access to kernel space.
Why is it dangerous to let user processes access kernel data structures directly?
It can lead to system crashes, security vulnerabilities, or resource misuse.