Overview of Contemporary OS
Open in the Padhaiko app8.1 Windows and Linux-based OS
Contemporary general-purpose desktop and server operating systems are dominated by Microsoft Windows and Linux-based operating systems. Although both support preemptive multitasking, virtual memory, graphical and CLI interfaces, and multi-user security, they differ markedly in kernel architecture, configuration model, and licensing.
Microsoft Windows
Modern Windows (Windows 10, Windows 11, Windows Server) is built on the Windows NT architecture:
- Hybrid Kernel: Core services (thread scheduling, interrupt/trap handling, synchronization) run in the Kernel, while higher-level resource managers (I/O Manager, Object Manager, Virtual Memory Manager, Security Reference Monitor) execute in the Executive inside kernel space, isolated from hardware specifics by the Hardware Abstraction Layer (HAL).
- Subsystems & API: User applications target the Win32 API (or .NET / WinUI) via the environment subsystem, with PowerShell and WSL 2 providing native automation and Linux compatibility.
- Configuration & Storage: System and per-user settings reside in a hierarchical binary database called the Windows Registry, and volumes use NTFS with per-drive letters (
C:\,D:\) and NTFS DACLs.
Linux-Based Operating Systems
A Linux-based OS (such as Ubuntu, Debian, Fedora, RHEL, or Arch) combines the Linux kernel with GNU system utilities, an init/service manager (systemd), a windowing system (Wayland/X11), and a package manager (apt, dnf, pacman):
- Monolithic Modular Kernel: Process scheduling (CFS/EEVDF), virtual memory, networking, and file systems all run in kernel address space for high throughput, while device drivers load and unload dynamically as Loadable Kernel Modules (LKMs).
- Everything-is-a-File & VFS: The Virtual File System (VFS) presents regular files, directories,
/devdevices, and/prockernel state inside a single/directory tree following POSIX standards. - Configuration & Package Management: Configuration lives in human-readable plain-text files under
/etc, and software updates flow through signed central package repositories.
| Aspect | Microsoft Windows | Linux-Based OS |
|---|---|---|
| Kernel Architecture | Hybrid (NT kernel + Executive + HAL) | Monolithic modular (with dynamic LKMs) |
| Source & Licensing | Proprietary / closed-source | Open-source (GPLv2 kernel + MIT/GPL userland) |
| File System & Hierarchy | NTFS; drive-letter roots (C:\, D:\) | EXT4 / XFS / Btrfs via VFS; single unified / root |
| Configuration Store | Central binary Windows Registry | Plain-text files in /etc and ~/.config |
| Primary Shells | PowerShell (object pipeline), Command Prompt | Bash / Zsh (POSIX text pipelines) |
| Dominant Strengths | Desktop ecosystem, enterprise Active Directory, PC gaming | Cloud servers, supercomputers, containers, embedded systems |
8.2 Embedded and mobile OS
Unlike desktop OSs designed to run arbitrary user software on abundant RAM and AC power, embedded and mobile operating systems target dedicated or battery-powered hardware with tight power, thermal, and memory budgets.
Embedded Operating Systems
Characteristics of an Embedded OS
An embedded OS controls dedicated microprocessor/microcontroller devices (routers, medical monitors, automotive ECUs, industrial PLCs, smart appliances):
- Small Footprint: Boots from read-only flash/ROM into kilobytes to a few megabytes of RAM, omitting unused desktop drivers and GUIs.
- Application-Specific & Headless: Often runs a fixed firmware image indefinitely without end-user software installation.
- High Reliability & Power Management: Employs hardware watchdog timers to recover from hangs and aggressive CPU sleep states.
- Examples: Embedded Linux (Yocto/Buildroot), FreeRTOS, VxWorks, Zephyr, QNX.
Mobile Operating Systems (Android and iOS)
Smartphones and tablets bridge embedded constraints and desktop capability, adding cellular/Wi-Fi/GPS radios, touch sensors, GPU compositing, and strict app-store security.
| Layer / Feature | Android (Google / AOSP) | iOS (Apple) |
|---|---|---|
| Kernel | Modified Linux kernel (adds Binder IPC, ashmem, wakelocks, Low Memory Killer) | XNU hybrid kernel (Mach microkernel + BSD subsystem + I/O Kit) |
| App Runtime | Android Runtime (ART) with Ahead-of-Time (AOT) & JIT compilation of DEX bytecode | Native ARM64 machine code compiled from Swift / Objective-C |
| Sandboxing & Security | Each app runs under a unique Linux UID with SELinux MAC enforcement and runtime permissions | Strict seatbelt sandbox, mandatory Apple code signing, Secure Enclave |
| Power & Lifecycle | OS aggressively suspends/kills background apps (Doze mode, App Standby) to preserve battery | Tight background execution budgets (APNs push, BackgroundTasks) |
8.3 IoT and RT operating system
IoT Operating Systems
Internet of Things (IoT) edge devices (smart agricultural sensors, wearables, smart meters) sit at the extreme low-power end of computing—often running on -bit/-bit/-bit MCUs with – RAM, tiny batteries expected to last years, and lossy wireless links.
Core Features of IoT Operating Systems
- Ultra-Low Memory & Tickless Sleep: Uses static memory allocation (avoiding heap fragmentation) and disables periodic timer interrupts during idle periods so the MCU enters deep sleep ( draw).
- Built-in Low-Power Networking: Integrates lightweight IPv6 over low-power wireless (6LoWPAN, IEEE 802.15.4), BLE, Thread, CoAP, and MQTT stacks directly into the OS.
- Programming Models: Event-driven protothreads (ultra-low RAM, single shared stack, e.g., Contiki-NG) or lightweight preemptive multithreading (e.g., RIOT OS, Zephyr, FreeRTOS).
Real-Time Operating Systems (RTOS)
In a Real-Time Operating System (RTOS), correctness depends not only on computing the right logical value, but also on delivering it before a strict timing deadline.
| Aspect | Hard Real-Time OS | Soft Real-Time OS |
|---|---|---|
| Deadline Semantics | Missing even a single deadline constitutes total system failure | Occasional missed deadlines degrade quality of service without catastrophic failure |
| Latency Guarantees | Strictly bounded worst-case interrupt and dispatch latency () | Probabilistic / best-effort low latency |
| Examples | Airbag controller, cardiac pacemaker, avionics flight control | Live audio/video streaming, VoIP, gaming consoles |
RTOS Scheduling and Synchronization Guarantees
- Deterministic Preemptive Priority Scheduling: The highest-priority ready task always preempts lower-priority tasks in constant bounded time.
- Rate Monotonic Scheduling (RMS): Static-priority algorithm assigning higher priority to tasks with shorter periods . By the Liu & Layland theorem, independent periodic tasks with execution times and periods are guaranteed schedulable if total CPU utilization satisfies:
- Earliest Deadline First (EDF): Dynamic-priority algorithm assigning highest priority to the job with the nearest deadline; achieves up to ( CPU utilization).
- Priority Inversion Mitigation: Occurs when a high-priority task waits for a mutex held by a low-priority task while a medium-priority task preempts the low-priority task indefinitely. Solved via Priority Inheritance Protocol (temporarily boosts the mutex holder's priority to match the highest waiting task) or Priority Ceiling Protocol.
Notable RTOS examples: FreeRTOS (microcontrollers), QNX Neutrino (microkernel RTOS used in automotive/medical systems), VxWorks (aerospace/Mars rovers), and Zephyr.
8.4 Robot and smart card operating system
Robot Operating System (ROS / ROS 2)
Despite its name, ROS (Robot Operating System) is not a standalone bare-metal kernel; it is a robotics middleware framework (meta-operating system) that runs on top of an existing host OS (commonly Ubuntu Linux or an RTOS) to coordinate distributed sensors, control loops, perception pipelines, and actuators.
ROS / ROS 2 Core Architecture
- Nodes: Modular, independent OS processes each performing one task (e.g., LiDAR driver, SLAM mapper, path planner, motor controller).
- Communication Primitives:
- Topics (Publish / Subscribe): Asynchronous many-to-many data streams for continuous sensor readings and velocity commands.
- Services (Client / Server): Synchronous request-reply RPC for quick state queries or mode switches.
- Actions: Asynchronous goal-oriented calls for long-running tasks (e.g., "navigate to waypoint") supporting periodic feedback and cancellation.
- ROS 1 vs. ROS 2: ROS 1 relied on a central
roscoremaster node (a single point of failure with weak real-time support). ROS 2 builds on DDS (Data Distribution Service) for decentralized peer discovery, configurable Quality of Service (QoS) reliability/latency policies, encryption (SROS2), and deterministic real-time execution.
Smart Card Operating System
A smart card OS runs inside an ultra-constrained, tamper-resistant microcontroller embedded in bank EMV chips, SIM/eSIM cards, electronic passports, and hardware security tokens. Typical hardware resources are – RAM, – EEPROM/Flash, no secondary disk, no MMU, and an -bit/-bit/-bit CPU often paired with a hardware cryptographic coprocessor (AES, RSA, ECC) and true random number generator.
Worked Out Examples
8.1
An RTOS schedules three independent periodic tasks using Rate Monotonic Scheduling (RMS):
- Task : execution time , period
- Task : execution time , period
- Task : execution time , period
Assign RMS priorities, compute the total CPU utilization , and check schedulability against the Liu & Layland bound.
Assigning static RMS priorities (shorter period higher priority): Since :
Computing total CPU utilization :
Evaluating the Liu & Layland RMS bound for :
Because , all three tasks are guaranteed to meet every deadline under RMS.
RMS priorities are . Total utilization is (), which is well below the RMS bound of (), so the task set is schedulable.
8.2
An IoT wireless environmental node uses an ARM Cortex-M4 microcontroller with Flash and SRAM running Zephyr OS:
- Flash allocations: Bootloader , kernel + 6LoWPAN/MQTT stack , sensor application .
- SRAM allocations: Kernel & static globals , network packet buffers of each, and statically allocated thread stacks of each.
Compute the total Flash and SRAM used and the remaining free headroom in each memory.
Computing Flash memory consumption and headroom:
Computing SRAM consumption and headroom:
- Packet buffers: .
- Thread stacks: .
Static pre-allocation avoids dynamic malloc heap fragmentation on the MCU.
The firmware uses of Flash ( free) and of SRAM ( free).
8.3
A point-of-sale terminal sends an ISO/IEC 7816 SELECT Command APDU to a Java Card smart card OS to activate a payment applet whose Application Identifier (AID) is long (A0 00 00 00 04 10 10):
- Header ():
CLA=00,INS=A4,P1=04,P2=00 - Command length
Lc(), followed by the -byte AID and expected response lengthLe=00().
Trace the APDU structure, calculate the total command frame length in bytes, and state what status word indicates success.
Constructing the Command APDU byte layout:
CLA INS P1 P2:00 A4 04 00()Lc:07(, length of AID payload)Data:A0 00 00 00 04 10 10()Le:00(, accept up to response bytes)
Command APDU : 00 A4 04 00 | 07 | A0 00 00 00 04 10 10 | 00
Response APDU : [FCI Template Data ...] | 90 00Computing total Command APDU size and interpreting the response:
The Java Card OS routes the APDU to the Card Manager, activates the matching applet inside its isolated firewall, and returns file-control metadata followed by status word 90 00 (normal completion).
The Command APDU is long (00 A4 04 00 07 A0 00 00 00 04 10 10 00), and status word 90 00 indicates successful applet selection.
Exercises
Exercise — Overview of Contemporary OS
Compare Windows and Linux-based operating systems across four dimensions: kernel architecture, file system/path hierarchy, system configuration mechanism, and shell/automation model.
Kernel and file system comparison:
- Kernel: Windows uses a hybrid NT kernel (Kernel + Executive + HAL), whereas Linux uses a monolithic modular kernel with loadable kernel modules.
- File system & hierarchy: Windows uses NTFS with per-drive roots (
C:\,D:\), whereas Linux uses EXT4/XFS/Btrfs behind a VFS under a single/root.
Configuration and shell comparison:
- Configuration: Windows stores settings in the binary Registry, whereas Linux stores plain-text configuration files in
/etc. - Shell: Windows uses PowerShell (passing structured .NET objects), whereas Linux uses POSIX shells like Bash (passing text streams across
/proc//devand standard utilities).
Windows uses a hybrid NT kernel, NTFS with drive letters, the binary Registry, and object-based PowerShell; Linux uses a modular monolithic kernel, VFS with a unified / tree, /etc text configs, and POSIX text-stream shells.
Define an Embedded OS and list three key design constraints it faces. Compare the architectures of Android and iOS with respect to kernel, application runtime, and security isolation.
Embedded OS definition and constraints: An embedded OS controls dedicated hardware devices (routers, medical instruments, automotive ECUs) under tight constraints: (1) very small RAM/flash footprint, (2) high unattended reliability (watchdog recovery, headless operation), and (3) strict power efficiency.
Android vs. iOS architectures:
- Android: Runs a modified Linux kernel (Binder IPC, wakelocks), Android Runtime (ART) compiling DEX bytecode, and isolates every app under a separate Linux UID with SELinux MAC rules.
- iOS: Runs Apple's XNU hybrid kernel (Mach + BSD), executes natively compiled ARM64 Swift/Objective-C binaries, and enforces strict seatbelt sandboxing and mandatory code signing.
Embedded OSs target dedicated hardware with minimal footprint, high reliability, and low power. Android pairs a modified Linux kernel with ART and per-UID SELinux isolation, while iOS pairs the XNU hybrid kernel with native ARM64 binaries and strict sandboxed code signing.
Differentiate between hard real-time and soft real-time operating systems with one example of each. Explain priority inversion in an RTOS and how priority inheritance solves it.
Hard vs. soft real-time systems:
- Hard RTOS: Every timing deadline must be met deterministically; a single missed deadline is a critical failure (e.g., automotive airbag controller or avionics control).
- Soft RTOS: Deadlines are important for quality, but occasional misses degrade output smoothly rather than causing failure (e.g., live video streaming).
Priority inversion and priority inheritance: Suppose low-priority task holds mutex , high-priority task blocks waiting for , and medium-priority task preempts repeatedly—forcing to wait behind (priority inversion). With Priority Inheritance, the RTOS temporarily elevates 's priority to 's priority while holds , preventing from preempting until is released.
Hard RTOS (e.g., airbag ECU) cannot tolerate any missed deadline, whereas Soft RTOS (e.g., video streaming) degrades gracefully. Priority inheritance prevents unbounded priority inversion by temporarily raising a mutex-holding low-priority task's priority to that of the blocked high-priority waiter.
An RTOS executes four independent periodic tasks with pairs: , , , and (in milliseconds). Compute the total CPU utilization , compare it with the Liu & Layland RMS bound and the EDF bound, and determine schedulability under both algorithms.
Calculating total CPU utilization :
Comparing against RMS and EDF bounds ():
Since , the task set is guaranteed schedulable under both RMS and EDF.
Total utilization (), which is below both the RMS bound () and EDF bound (); therefore, the tasks are schedulable under both RMS and EDF.
Why can a standard desktop OS not run on a typical IoT sensor node? Describe the key architectural features of an IoT operating system (such as Contiki-NG, RIOT OS, or Zephyr).
Why desktop OSs do not fit IoT nodes: IoT sensor motes typically have – of SRAM, no MMU or disk, and small batteries expected to last months or years—whereas desktop OSs require gigabytes of RAM, MMU-backed virtual memory, and continuous high-power background services.
Core IoT OS features:
- Minimal static footprint & event-driven/lightweight threads: Contiki-NG uses stackless protothreads, while RIOT/Zephyr use lightweight static threads to fit in tens of kilobytes.
- Tickless power management: Sleeps the MCU and radio aggressively between sensor readings.
- Built-in low-power protocols: Native support for IEEE 802.15.4, 6LoWPAN, BLE, CoAP, and MQTT.
Desktop OSs exceed IoT RAM, MMU, and power budgets by orders of magnitude. IoT OSs (Contiki-NG, RIOT, Zephyr) use kilobyte static footprints, protothreads/lightweight threads, tickless deep sleep, and native 6LoWPAN/BLE/MQTT stacks.
Explain why ROS / ROS 2 is called a meta-operating system and describe its Nodes, Topics, Services, and Actions (plus the shift from roscore to DDS in ROS 2). Also describe the hardware constraints, APDU communication model, and security design of a Smart Card OS.
ROS / ROS 2 architecture: ROS runs over a host OS (usually Linux) to coordinate distributed robotics software: Nodes (modular processes) exchange continuous streams over Topics (pub/sub), synchronous requests over Services, and long-running preemptible tasks over Actions. ROS 2 replaces ROS 1's single-point-of-failure roscore with decentralized DDS middleware providing real-time QoS and security.
Smart Card OS architecture: Running inside tamper-resistant chips with kilobytes of RAM/EEPROM and no MMU or disk, a Smart Card OS operates passively via half-duplex APDU command-response packets (ISO/IEC 7816/14443). Multi-application cards (Java Card) isolate applets behind VM firewalls and protect keys using hardware crypto engines, tamper sensors, and side-channel-resistant execution.
ROS 2 is robotics middleware over Linux/RTOS connecting Nodes via Topics, Services, and Actions over decentralized DDS. A Smart Card OS runs in kilobytes of tamper-resistant memory using passive APDU command-response exchanges and Java Card applet firewalls.