1/171
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Operating System
Software that provides an environment for applications to execute while managing and controlling the underlying hardware.
Operating-System Service
A function provided by the operating system to applications or users, such as program execution, I/O, file manipulation, communication, and error detection.
User Interface
A mechanism through which users interact with a computer, such as a CLI, GUI, touch interface, or batch interface.
Shell
A user-space command interpreter that reads and executes commands by requesting operating-system services. It is normally not part of the kernel.
Command-Line Interface (CLI)
A text-based interface in which users enter commands, such as bash, zsh, PowerShell, or cmd.exe.
Program Execution
An OS service that loads a program into memory, establishes its execution environment, begins execution, handles termination, and reclaims resources.
I/O Operations
Operating-system services that allow applications to communicate with devices such as disks, keyboards, displays, network interfaces, printers, and USB devices.
Why shouldn't applications normally access hardware directly?
The operating system provides controlled abstractions while device drivers handle hardware-specific details, improving safety and consistency.
File-System Manipulation
OS services that allow programs to create, delete, open, close, read, write, and obtain information about files and directories.
Common UNIX file operations
open(), read(), write(), close(), lseek(), stat(), and unlink().
Process Communication
The exchange of information between processes on the same computer or across a network.
Two major process communication models
Shared memory and message passing.
Shared Memory
A communication model in which multiple processes access a common region of memory.
Why does shared memory usually require synchronization?
To prevent race conditions when multiple processes access or modify the same memory.
Message Passing
A communication model in which processes exchange messages rather than directly sharing memory.
Examples of message-passing mechanisms
Pipes, sockets, and message queues.
Error Detection
An operating-system service that detects and responds to problems such as memory errors, disk failures, illegal instructions, network failures, and file-system corruption.
Resource Allocation
The OS determines how CPU time, memory, storage, I/O devices, and network bandwidth are distributed among competing processes.
CPU Scheduler
The operating-system component that decides which ready process executes next.
Accounting
Tracking operating-system resource usage such as CPU time, memory consumption, disk usage, network traffic, process counts, and I/O activity.
Examples of Linux accounting and monitoring tools
top, ps, time, free, and df.
Protection
Determines whether a user or process is permitted to access a particular resource.
Security
Protects the system against unauthorized access, attacks, and other threats.
Examples of OS protection and security mechanisms
Authentication, file permissions, process isolation, memory protection, access control, and encryption.
Command Interpreter
Another name for a shell; a program that reads, parses, and executes user commands.
What usually happens when a shell receives the command ls?
The shell creates or uses a process and launches the ls program rather than performing the directory listing itself.
System Call
A controlled mechanism through which a user-mode program requests a service from the operating-system kernel.
User Mode
A restricted CPU execution mode used by ordinary applications, libraries, and shells.
Kernel Mode
A privileged CPU execution mode used by the kernel and components such as device drivers, the scheduler, and memory manager.
Privileged Instruction
An instruction that normally can only be executed in kernel mode because it could affect the entire system.
Why can't normal user programs execute privileged instructions?
Restricting privileged instructions protects the system from incorrect or malicious programs.
What happens when a system call is made?
The application requests a service, the CPU transfers control to the kernel and enters kernel mode, the kernel performs the operation, and control returns to user mode.
System-Call Interface
The controlled boundary through which user-space programs invoke operating-system kernel services.
API
A programmer-visible, source-level interface that specifies how software requests a service.
System Call vs API
An API is the programmer-visible interface, while a system call is the actual request made to the operating-system kernel.
Is every library function a system call?
No. A library function may operate entirely in user space or invoke one or more system calls.
printf() vs write()
printf() is normally a C library function, while write() is associated with the operating system's system-call interface.
POSIX
Portable Operating System Interface, a standard programming interface used by UNIX-like operating systems to improve source-code portability.
Important POSIX calls in CSI 4337
fork(), exec(), waitpid(), open(), read(), write(), close(), and dup2().
Major categories of system calls
Process control, file management, device management, information maintenance, communication, and protection.
Process-Control System Calls
System calls that create or terminate processes, load programs, wait for state changes, deliver signals, or obtain process information.
Examples of process-control system calls
fork(), exec(), waitpid(), exit(), kill(), and getpid().
File-Management System Calls
System calls used to open, read, write, close, seek within, inspect, or delete files.
Typical file lifecycle
open → read or write operations → close.
Device-Management System Calls
Controlled operations for requesting, releasing, reading, writing, or configuring hardware devices.
Information-Maintenance System Calls
Calls that obtain information such as time, process ID, user ID, file metadata, system information, and resource usage.
Examples of information-maintenance calls
getpid(), getuid(), and stat().
Communication System Calls
Calls that provide interprocess communication through mechanisms such as pipes, sockets, message queues, and shared memory.
Examples of communication system calls
pipe(), socket(), send(), recv(), and shm_open().
Protection System Calls
Calls used to control ownership, permissions, credentials, and user identity.
Examples of protection-related calls
chmod(), chown(), and setuid().
Three common ways to pass system-call parameters
Registers, a memory block, or the stack.
Passing parameters using registers
Arguments are placed directly into CPU registers before the system call.
Advantage of register parameter passing
It is fast.
Limitation of register parameter passing
The number and size of arguments are limited by the available CPU registers.
Passing parameters using a memory block
A register contains the address of a memory structure containing the system-call parameters.
Passing parameters using the stack
System-call parameters are placed on the process stack for the kernel to access.
System Services
Ordinary user-space programs that provide convenient environments for program development and execution. They are not kernel entry points.
Examples of system services
File utilities, editors, compilers, assemblers, linkers, loaders, debuggers, shells, networking programs, monitoring tools, and background services.
Examples of Linux system programs
cp, mv, rm, ls, gcc, g++, gdb, ssh, ps, top, and systemctl.
Three important levels between a user command and the kernel
Application or system program → Library or API → System call → Kernel.
System Program vs System Call
A system program is an ordinary user-space application, while a system call is a controlled request for a kernel service.
Compiler
Translates source code into machine instructions and metadata, usually producing an object file.
Object File
Compiled machine code and metadata that has not yet been combined into a complete executable.
Linker
Combines object files and libraries and resolves references among them to produce an executable.
Loader
Places an executable into memory, maps required code and data, connects dynamic libraries, establishes the execution context, and transfers control to the program.
Program creation and execution sequence
Source code → Compiler → Object file → Linker → Executable → Loader → Running process.
Static Linking
Required library code is copied directly into the executable.
Advantages of static linking
Simpler deployment because fewer external libraries are required at runtime.
Disadvantages of static linking
Larger executables, duplicated library code, and library updates usually require relinking.
Dynamic Linking
Libraries are associated with a program at load time or runtime rather than being completely copied into the executable.
Advantages of dynamic linking
Smaller executables, libraries can be shared between processes, and compatible library updates may not require rebuilding applications.
Linux shared-library extension
.so
macOS shared-library extension
.dylib
Windows shared-library extension
.dll
Why are compiled applications normally operating-system specific?
The executable format, system-call interface, libraries, runtime environment, and ABI must match the operating system.
Linux executable format
ELF.
Windows executable format
PE.
macOS executable format
Mach-O.
ABI
Application Binary Interface; the binary-level conventions that determine how compiled components interact.
What does an ABI define?
Calling conventions, register usage, data layout, executable format, and binary library or system interfaces.
API vs ABI
An API defines how source code calls services, while an ABI defines how already-compiled components interact at the binary level.
Does POSIX guarantee the same compiled binary runs on every UNIX-like OS?
No. POSIX improves source-code portability but does not guarantee binary compatibility.
Ways to improve software portability
Standard APIs, cross-platform libraries, virtual machines, interpreters, and bytecode-based runtimes.
Examples of cross-platform libraries
Qt, SDL, and Boost.
Policy
Determines what decision or choice should be made by the operating system.
Mechanism
Determines how a particular operating-system operation is performed.
Policy vs Mechanism
Policy answers "what should be done?" while mechanism answers "how is it done?"
CPU scheduling policy example
Deciding whether process A or process B should run next.
CPU scheduling mechanism example
Pausing a process, saving its registers, restoring another process's registers, and resuming execution.
Why separate policy from mechanism?
It allows policies to change without redesigning the underlying implementation mechanism.
Common operating-system design goals
Usability, performance, reliability, security, scalability, compatibility, flexibility, and maintainability.
Why can operating-system design goals conflict?
Improving one property may hurt another, such as additional security checks increasing overhead.
What languages are modern kernels primarily written in?
Mostly C or C++, with assembly for architecture-specific and very low-level operations.
Common uses of assembly in an operating system
Boot code, interrupt entry, context switching, and processor-specific operations.
Monolithic Kernel
A kernel architecture in which most operating-system services execute together in kernel space.
Advantages of a monolithic kernel
High performance, fast communication between kernel components, and low IPC overhead.
Disadvantages of a monolithic kernel
A large trusted kernel, kernel bugs can affect the whole system, and the codebase can be difficult to maintain.
Traditional UNIX kernel architecture
Monolithic.
Linux kernel architecture
Largely monolithic with extensive support for loadable modules.