Kernel, drivers and user space

The layers of a system from hardware to application: kernel, drivers and modules, system calls, libraries, shell, and the border between kernel mode and user mode.

  • 25 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios

A few cards from the deck

  • Kernel: what is it?

    Show the answer

    The core of the operating system, the only part running with full privileges: it manages processes, memory, files and devices.

    Ordinary programs never touch the hardware directly: they go through it, and it checks every request.

  • In a C program on Linux, which of these function calls makes the processor enter the kernel?

    • write(1, buf, n)
    • strlen(buf)
    • memcpy(dst, src, n)
    • toupper(c)
    Show the answer

    write(1, buf, n)

    write sends bytes to a file or a terminal: only the kernel can reach them, hence the system call. strlen, memcpy and toupper are libc functions that work only in the process's own memory, in user mode.

  • When a program calls …, the processor switches from … mode to … mode for as long as the request is handled.

    Show the answer

    When a program calls write, the processor switches from user mode to kernel mode for as long as the request is handled.

    When the call ends, the kernel hands the processor back to the program in user mode, with the result of its request.

  • Device driver: what is it?

    Show the answer

    Code that knows how to talk to one specific piece of hardware (disk, network card, screen) and presents it to the rest of the system in a uniform way.

    Thanks to it, a program writes to a file or sends a packet without knowing which brand of disk or card is installed.

  • After plugging in a Wi-Fi dongle, dmesg shows "firmware: failed to load" and no network interface appears. What is the probable cause, and what to do?

    • The USB port is faulty: plug the dongle into another computer
    • The shell is not allowed to see the dongle: restart the session as root
    • The driver is loaded but the dongle's firmware is missing: install its package
    • The kernel is too recent: go back to an older version of the distribution
    Show the answer

    The driver is loaded but the dongle's firmware is missing: install its package

    The message comes from the kernel: the dongle's driver asked for that file, so the dongle is recognised and its driver loaded. Many chips need separately supplied firmware that the distribution offers as a package (for example linux-firmware).