🎓 BookMCQ
← Back to 18. The Linux System

📝 The Linux Process File System (12 MCQs)

Process Information Exposed Through procfs

The Linux process file system, known as procfs, is a virtual filesystem that exposes information about running processes and selected kernel state. It is commonly mounted at /proc and presents structured entries that applications and administrators can inspect using ordinary file operations. Unlike a disk filesystem, most procfs content is generated dynamically by the kernel when accessed.

Why Process and Kernel State Needs an Inspection Interface

Administrators and system utilities need information about process identifiers, memory usage, open descriptors, CPU details, and kernel configuration. Direct access to internal kernel structures would be unsafe and implementation-dependent. procfs provides a controlled textual or structured interface while preserving kernel ownership of the underlying information.

Process Directories and Kernel Information Entries

Each process commonly has a numeric directory under /proc, such as /proc/2450. Entries such as status, cmdline, maps, and fd expose selected process information. Other files, including /proc/cpuinfo and /proc/meminfo, report system-wide information. The kernel generates much of this data when a process reads the relevant entry.

Example of Inspecting a Running Process

An administrator identifies a process with PID 2450 and reads /proc/2450/status. The entry reports information such as its name, state, memory details, and identifiers. Access permissions may restrict sensitive information, and the contents can change as the process executes.

Diagnostic Value and Information Exposure

procfs supports monitoring, debugging, scripting, and system administration without requiring specialised binary interfaces for every statistic. Its information may be permission-restricted because process details can reveal sensitive data. Entries are not permanent disk files, and scripts must account for process termination and changing values during inspection.

Misconceptions About procfs

'Files under /proc are stored permanently on disk' is false because procfs is virtual. 'Every process directory remains after process termination' ignores the dynamic lifetime of process entries. 'Reading procfs always reveals unrestricted information' overlooks access checks and system configuration.

Exam Focus: Process Entries and Virtual Filesystem Behaviour

Identify procfs as a virtual filesystem and distinguish process-specific entries from system-wide information. Explain how /proc/PID/status and /proc/PID/fd can support inspection. Questions may ask why procfs consumes no ordinary disk space for its generated contents or how access permissions protect process information.

Key Terms of Linux procfs

  • procfs - Virtual filesystem exposing process information.
  • /proc - Conventional procfs mount location.
  • PID - Numeric process identifier.
  • /proc/PID/status - Reports selected process attributes.
  • Virtual filesystem - Filesystem interface without ordinary disk storage.
2
Easy
6
Medium
4
Hard

📝 All The Linux Process File System MCQs

Q1. A driver needs to use I/O port 0x3F80x3F8 for a serial device. What must it do before accessing the port?

A.Write directly to the port
B.Reserve the port through the kernel resource database ✅
C.Disable all interrupts
D.Reboot the system
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The kernel maintains a database of allocated I/O ports. By reserving 0x3F80x3F8 first, the driver ensures no other module is using that address, preventing clashes. Writing directly bypasses the safety check and can cause conflicts. Disabling interrupts does not address resource ownership, and rebooting is unnecessary. Reserving via the database is the prescribed method, guaranteeing exclusive access and allowing administrators to see the allocation.

Q2. Why does Linux keep a list of allocated I/O ports, IRQ lines, and DMA channels?

A.To speed up system boot
B.To prevent two drivers from claiming the same hardware resource ✅
C.To increase available memory
D.To enable faster networking
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The list acts as a central registry that records which driver owns each hardware resource. This prevents two drivers from simultaneously using the same I/O address, interrupt line, or DMA channel, which would cause undefined behavior or system crashes. Speeding up boot, adding memory, or improving networking are unrelated to resource tracking. Therefore, the primary purpose is conflict avoidance.

Q3. What term describes the kernel mechanism that stops two drivers from using the same hardware resource?

A.Autoprobe
B.Conflict‑resolution database ✅
C.Direct Memory Access
D.Scheduler
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The conflict‑resolution database is the component that records reservations for I/O ports, IRQs, and DMA channels. When a driver requests a resource, the kernel checks this table and denies the request if the resource is already allocated. An autoprobe is a method that automatically detects devices, not a conflict‑prevention tool. Direct Memory Access is a transfer technique, and the scheduler manages CPU time, so neither term fits the description.

Q4. Two drivers—the parallel‑printer driver and the PLIP network driver—both request the same parallel port. What does the kernel do if the second driver attempts to reserve the port after the first has succeeded?

A.It rejects the second reservation ✅
B.It allows both drivers to use the port simultaneously
C.It crashes the system
D.It unloads the first driver
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When the first driver reserves the parallel port, the kernel records the allocation. A subsequent reservation request for the same port is checked against this record and is denied, typically returning an error such as −EBUSY-EBUSY. Allowing both drivers would cause data corruption, and the kernel does not crash or unload the first driver automatically. The correct behavior is to reject the second request.

Q5. How does the conflict‑resolution mechanism help a system administrator diagnose hardware problems?

A.It hides which driver owns each resource
B.It provides a clear list of driver‑to‑resource mappings ✅
C.It randomizes resource assignments each boot
D.It disables system logging for drivers
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The kernel’s resource database can be queried (e.g., via /proc/ioports or similar interfaces) to see exactly which driver has claimed each I/O port, IRQ, or DMA channel. This transparency lets administrators pinpoint conflicts or missing allocations. Hiding information or randomizing assignments would make troubleshooting harder, and disabling logging would remove valuable diagnostic data. Therefore, the mechanism’s visibility is the key benefit.

Q6. A module tries to reserve IRQ 5, but the kernel reports it is already in use. According to Linux guidelines, what should the module do?

A.Forcefully take the IRQ anyway
B.Abort loading the module
C.Choose an alternative IRQ or fail gracefully ✅
D.Reboot the whole system
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The proper response is to handle the failure gracefully: either select another free IRQ or abort loading with a clear error message. Forcing the reservation could corrupt device operation, and aborting without attempting alternatives may unnecessarily limit functionality. Rebooting is excessive and unrelated to the specific conflict. Graceful handling preserves system stability while respecting existing allocations.

Q7. Why can autoprobes interfere with manually loaded drivers, and how does the conflict‑resolution database mitigate this issue?

A.Autoprobes ignore the database, causing double allocation; the database blocks duplicate reservations
B.Autoprobes always use higher priority, so manual drivers never run
C.Autoprobes only affect network devices, not parallel ports ✅
D.The database disables autoprobes entirely
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Autoprobes attempt to detect devices at boot and may claim resources before a manually loaded driver does. If both rely on the same reservation system, the database will reject the second claim, preventing duplicate usage. While autoprobes have priority in some cases, the kernel’s reservation check remains the safeguard. The database does not disable autoprobes; it simply ensures that any resource request, whether from an autoprobe or manual load, is validated against existing allocations.

Q8. You have a custom board that needs DMA channel 2. The system reports channels 0‑3 are free. What steps should you follow to allocate the channel without causing conflicts?

A.Directly program the DMA controller
B.Reserve channel 2 through the kernel resource database, then handle a possible rejection
C.Ignore the kernel and use any channel you like
D.Modify the BIOS to hide other DMA channels ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The safest approach is to request channel 2 via the kernel’s resource reservation API. If the reservation succeeds, the driver can safely program the DMA controller. If it fails (e.g., another driver already holds the channel), the driver must either choose a different channel or abort. Directly programming the controller without reservation bypasses conflict checks, and ignoring the kernel can lead to overlapping usage. Changing BIOS settings is unrelated to kernel‑level resource management.

Q9. When a new network‑card driver is added and the parallel printer stops working, which conflict‑resolution failure is most likely responsible?

A.The driver used the same I/O port as the printer
B.The driver used the same IRQ line as the printer ✅
C.The driver misconfigured the DMA channel
D.The driver disabled system interrupts
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Parallel printers typically use IRQ 7 (or IRQ 5 on some systems). If the new network‑card driver also requests that IRQ, the kernel will allow the first reservation and reject the second, or it may dynamically reassign one driver, causing the printer to lose its interrupt. Sharing the same I/O port is less common, and misconfiguring DMA or disabling interrupts would affect broader system behavior, not just the printer. Therefore, an IRQ conflict is the most plausible cause.

Q10. What is the main benefit of a single‑supplier UNIX solution compared to Linux’s modular driver approach?

A.It provides faster CPUs
B.It guarantees predictable hardware configurations ✅
C.It adds more RAM to the system
D.It improves graphics performance
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A single‑supplier solution means the vendor designs both hardware and software together, so the OS knows exactly which devices exist and how they are wired. This predictability reduces the need for dynamic resource discovery and conflict handling that Linux must manage with many possible drivers. Faster CPUs, additional RAM, or better graphics are hardware characteristics, not inherent advantages of a unified vendor approach.

Q11. A developer writes a test that reserves I/O port 0x2200x220 twice in the same module. What result should the second reservation attempt produce?

A.Success, the port is allocated twice
B.Failure with error −EBUSY-EBUSY ✅
C.System panic and reboot
D.Silent ignore, no error reported
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When the first reservation succeeds, the kernel marks 0x2200x220 as taken. A second attempt to reserve the same address triggers the kernel’s conflict‑resolution check, which returns an error code such as −EBUSY-EBUSY to indicate the resource is already in use. Allowing a double allocation would cause undefined hardware behavior, and a panic is not the normal response. Silent ignoring would hide the conflict, contrary to the kernel’s design.

Q12. If a module fails to reserve a required DMA channel because it is already allocated, what is the recommended action for the module?

A.Force the allocation by writing to the DMA controller directly
B.Abort loading and report the error to the user ✅
C.Continue without DMA, ignoring performance impact
D.Replace the kernel with a custom version
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The correct practice is to abort the module’s initialization and return an error, informing the user that the needed DMA channel is unavailable. Forcing allocation would corrupt other devices, and silently continuing without DMA could degrade performance or cause malfunction. Replacing the kernel is unnecessary and outside the module’s scope. Proper error handling preserves system stability and informs administrators of the resource conflict.

🔗 Related Topics (MCQs)