Complete exercises at:

In a concise presentation:

  1. Explain the concept of OS kernel. Distinguish it from other programs and relate it to the smallest running system.
  2. What files in your system represent the Linux kernel?
  3. What is the purpose of the Linux/Unix “init” program?
  4. What program is the “init” program on your Linux system?
  5. Demonstrate running bash directly as PID 1 (e.g., boot with init=/bin/bash). Observe and record the terminal/job-control behavior.
  6. Explain why running bash directly as PID 1 loses job control (the “cannot set terminal process group” error) and why signals like Ctrl-C do not work.
  7. Use an LLM to help you understand items 5–6.
    • Document the prompts you used.
    • Quote the LLM’s responses.
    • Evaluate whether they were correct and complete.
    • Include at least one case where the LLM was wrong, vague, or needed correction, and how you verified the correct answer.
  8. Write a minimal init program that correctly launches bash after complete the system call exercise.
    • Open the console (e.g., /dev/console).
    • Create a new session with setsid().
    • Set the controlling terminal with ioctl(fd, TIOCSCTTY, 0).
    • exec bash.
    • Demonstrate that job control and signal handling now work (no warning, Ctrl-C interrupts, Ctrl-Z + fg work).
    • Consult the manual pages to answer:
      • man 2 setsid — What does setsid(2) return, and under what condition does it fail? (Hint: process group leader.)
      • man 1 setsid — How can a shell script use the setsid utility instead of calling the syscall directly?
      • man 2 ioctl_tty (or man 4 ioctl_tty) — What does TIOCSCTTY do? What happens if the terminal is already the controlling terminal of another session?
      • man 4 tty (or man 7 tty) — Explain the concepts of controlling terminal, session, and foreground process group.
      • Combining the pages: Why must setsid() be called before TIOCSCTTY?
    • (Optional) strace your own init to observe the setsid and ioctl calls in action.
  9. Investigate the Windows equivalent of the kernel + init pairing.
    • The Windows kernel starts a first user-mode process during boot. What is it, and what does it do? (Hint: its name is a four-letter acronym.)

    • Unlike Linux’s single init/PID 1, Windows distributes the “start everything else” role across multiple processes. Identify at least two other processes involved in this handoff and explain their roles.

    • Does Windows have a single process that stays resident forever as PID 1 does on Linux? Explain your answer.

    • Cite your sources (Microsoft documentation, Windows Internals, or reliable technical references). Note any differences you find across Windows versions.

  10. Discuss lessons learned, errors made, and challenges encountered.

Note: The Windows questions are harder than the Linux ones because the architecture differs and the sources are less uniform. You are not expected to have a perfect answer. You are expected to show your research process, cite what you found, and note where sources disagree or where you got stuck.