Describe the key features of UNIX.
Separation of kernel from user space. Processes are units of scheduling and protection. All IO looks like file operations.
What is Linux?
It is a multiuser, multitasking system with UNIX compatible tools.
State the Linux design principles.
Main design goals are speed, efficiency and standardisation. POSIX compliant.
Describe the 3 components of a Linux system.
The kernel for maintaining abstraction of the operating system. System libraries for interacting with the kernel. System utilities for individual management tasks.
What are kernel modules?
Sections of kernel code that can be compiled, loaded and unloaded independently.
What are kernel modules used for?
To implement device drivers, file systems or networking protocols.
State the benefit of kernel modules.
Allow non-GPL compliant code to be distributed. Allows a Linux system to be setup with a minimal kernel, without device drivers compiled in.
Why does using kernel modules require conflict resolution?
The kernel must manage modules trying to access the same hardware.
Describe how to create a new process in UNIX.
fork to create a new process. exec to run a new program.
Describe the 3 kinds of properties stored about the process in Linux.
Identity: the process ID, process credentials (user ID and group IDs), namespace gives specific view of file system hierarchy. Environment: inherited from parent, includes command-line arguments and environment variables. Context: the state of a program at a point in time.
What attributes does process context include in Linux?
The scheduling context + accounting information. The file system context + file table. Signal handler table for the per-process signal handling routine. Virtual-memory context: the process’ private address space.
State the difference between processes and threads on Linux.
A thread is a process that shares its parent’s address space.
On UNIX
what is clone?
Describe the 5 process states on UNIX.
Running. Uninterruptible sleep (waiting for resource/signal). Interruptible sleep (waiting for resource). Stopped (paused). Zombie (exited).
Describe the process scheduling algorithm in traditional UNIX.
Round robin within priority level with dynamic priority.
Describe completely fair scheduler.
The target latency is the interval during which every runnable task should run at least once. vruntime holds the per-task virtual run time, its decay rate depends on the nice value. Scheduler picks task with lowest vruntime.
Describe the two ways of requesting kernel-mode execution.
Process requests an OS service by a syscall or implicitly when a page fault occurs. Device drivers deliver a hardware interrupt, causing the CPU to execute a kernel-defined handler for the interrupt.
Describe how kernel code is guaranteed to run without interruption in Linux.
Single processor: disable kernel pre-emption. Multiple processor: acquire spin lock, causing other processes to wait until the lock is available.
Compare the top half and bottom half interrupt handlers.
Top half are normal interrupt service routines, runs with recursive interrupts disabled. Bottom half is ran with all interrupts enabled, and a mini-scheduler to ensure the bottom half never self-interrupts.
Describe the methods of inter-process communication on UNIX.
Signals: process-to-process, carry no information other than the signal number. Wait queues: process puts itself to wait queue for an event, then informs scheduler it is no longer running. Pipes: a type of inode in the VFS. Shared memory: fast but no synchronisation mechanism.