Linux Interview Questions

1. Booting Process in Detail

1. BIOS/UEFI Initialization

  • BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface) initializes the hardware.
  • It performs a Power-On Self-Test (POST) to check the hardware’s functionality.
  • It looks for the bootloader in the configured bootable device (e.g., HDD, SSD, USB).

2. Bootloader (e.g., GRUB, LILO, systemd-boot)

  • The bootloader is loaded from the boot sector.
  • Its job is to load the Linux kernel into memory.
  • It allows selection of different kernels or operating systems (if configured).
  • Common bootloaders:
  • GRUB (Grand Unified Bootloader): Most common in Linux distributions.
  • LILO (Linux Loader): Older but less commonly used.
  • systemd-boot: A simpler alternative for EFI systems.

3. Kernel Initialization

  • The bootloader loads the Linux kernel into memory.
  • The kernel initializes and configures system hardware (e.g., CPU, memory, storage).
  • It mounts the initial RAM disk (initramfs or initrd), a temporary filesystem that contains drivers and tools needed to initialize the root filesystem.

4. Initial RAM Disk (initramfs/initrd)

  • The initramfs provides necessary modules and drivers to load the root filesystem (e.g., storage, RAID, encryption drivers).
  • Once the root filesystem is accessible, the system switches to it.

5. System Initialization (init/systemd)

  • The kernel hands over control to the init system:
  • init: The traditional initialization system (used in older Linux systems).
  • systemd: A modern init system that is faster and widely used in current distributions.
  • The init system starts essential system services, daemons, and user-space programs.

6. Runlevels/Targets

  • The init system transitions the system to the specified runlevel or target:
  • Runlevels (for init): Define system states (e.g., single-user mode, multi-user mode, graphical mode).
  • Targets (for systemd): Define system goals (e.g., graphical.targetmulti-user.target).

7. Login and Shell

  • After all services are started, the system displays the login prompt.
  • A graphical user interface (GUI) may be launched if configured (graphical.target in systemd).
  • The user can log in and begin using the system.

2. Benefits of a Multiprocessor System

  • Increased Performance: Tasks are executed in parallel.
  • Fault Tolerance: A failure in one processor may not affect others.
  • Scalability: Easily expandable for increased workload.

3. RAID Structure in OS

RAID (Redundant Array of Independent Disks) is used for data redundancy and performance.

  • RAID Levels:
  • RAID 0: Striping for speed, no redundancy.
  • RAID 1: Mirroring for redundancy.
  • RAID 5: Striping with parity for balanced performance and redundancy.
  • RAID 6: Double parity for added fault tolerance.
  • RAID 10: Combination of RAID 1 and 0.

4. Commands to Check CPU Utilization

  • top
  • htop
  • vmstat
  • mpstat
  • sar

5. Paging Concept

Paging divides memory into fixed-size blocks (pages). The OS maps virtual memory to physical memory using a page table.

6. System Calls

System calls provide an interface between user programs and the OS kernel. Examples include:

  • open()read()write()fork()exec().

7. Fork()

fork() creates a new process by duplicating the current process. The child process receives a PID of 0 and executes separately from the parent.

8. Process Life Cycle

  • New: Process is created.
  • Ready: Waiting for CPU allocation.
  • Running: Actively using the CPU.
  • Waiting: Waiting for I/O.
  • Terminated: Completed execution.

9. Multitasking vs. Multiprocessing OS

  • Multitasking: One CPU switches between tasks.
  • Multiprocessing: Multiple CPUs handle tasks simultaneously.

10. Scheduling Algorithm

Scheduling manages CPU tasks:

  • First-Come-First-Served (FCFS): Processes executed in arrival order.
  • Shortest Job Next (SJN): Executes shortest tasks first.
  • Round Robin (RR): Cycles through tasks in time slices.
  • Priority Scheduling: Processes prioritized.
  • Multilevel Queue: Tasks divided into queues.

11. How PING and TRACEROUTE Work

  • PING: Sends ICMP echo requests to test connectivity.
  • TRACEROUTE: Tracks the path packets take to a destination using TTL expiration.

12. Paging vs. Segmentation

  • Paging: Fixed-size blocks, physical memory-focused.
  • Segmentation: Variable-size blocks, logical memory division.

13. Importance of iNodes

iNodes store metadata about files, like permissions, size, and pointers to disk blocks.

14. Threads in OS

Threads are lightweight processes sharing memory and resources of the parent process.

15. Check Disk Free Space in Linux

Commands:

  • df -h
  • du -sh

16. Cache and Types

Cache is fast memory storing frequently used data. Types:

  • L1/L2/L3 Cache: CPU-specific caches.
  • Disk Cache: Buffers data from disk I/O.

17. Virtual Memory

Virtual memory extends RAM using disk space. It supports large programs by swapping inactive data.

18. Device Heating Up Troubleshooting

  • Check CPU/GPU utilization.
  • Clean air vents and apply thermal paste.
  • Verify fan operation.

19. Bootstrap Program

The bootstrap program is a small loader that initializes the OS kernel during the boot process.

20. Demand Paging

Pages are loaded into memory only when needed, reducing the initial load time.

21. RTOS (Real-Time Operating System)

An RTOS guarantees timely task execution, critical for embedded systems like robotics.

22. Zombie Process

A zombie process has completed execution but still has an entry in the process table.

23. Thrashing Concept

Excessive paging causes the system to spend more time swapping than executing processes.

24. FTP Slow Transfer Troubleshooting

  • Check network bandwidth.
  • Switch to active/passive FTP mode.
  • Optimize file compression.

25. Linux Booting Issues

  • Common Issues:
  • Kernel panic.
  • Missing GRUB.
  • Troubleshooting:
  • Use recovery mode.
  • Reinstall GRUB.
  • Check logs in /var/log/.

Connect on: Ig:-@coderjourneys

gmail:- hetvi4448shah@gmail.com

Support us by buying me a coffee ☕

Do share your valuable opinion, I appreciate your honest feedback!

Banner Content
Tags: ,

Related Article

0 Comments

Leave a Comment