Introduction to Computing

Chapter 4
Operating Systems and Computing Platforms

Bachelor Program in Mechatronics Engineering
Introduction to Computing   •   Bachelor

Operating Systems and Computing Platforms

Introduction

An operating system (OS) is the software layer that manages a computer’s hardware resources and provides services to application programs. It controls processors, memory, storage, input/output devices, and communication interfaces while presenting useful abstractions such as processes, files, windows, and network sockets. Without an operating system, every application would need to contain its own hardware-control software, making development difficult and systems unreliable.

For mechatronics engineers, operating systems are important because modern products combine computation with sensors, actuators, communication networks, and physical processes. A robotic arm, autonomous vehicle, industrial controller, or smart instrument may use several computing platforms simultaneously: a microcontroller for real-time control, an embedded Linux computer for perception, a server for data analysis, and a mobile or desktop interface for operators.

Learning Objectives

By the end of this chapter, a student should be able to:

  1. Explain the purpose and major components of an operating system.
  2. Distinguish processes, threads, concurrency, and parallelism.
  3. Describe virtual memory, memory protection, and file management.
  4. Explain the roles of device drivers and system calls.
  5. Compare graphical and command-line user interfaces.
  6. Explain virtualization, virtual machines, and containers.
  7. Compare desktop, mobile, server, and embedded computing platforms.
  8. Select a suitable platform for a mechatronics application.
  9. Identify important reliability, security, safety, and ethical considerations.

1. The Operating System as a Resource Manager

A computer contains resources that may be shared by many programs. The central processing unit (CPU) executes instructions, memory stores active instructions and data, storage retains information when power is removed, and peripheral devices provide sensing, display, communication, and actuation. The OS coordinates access to these resources.

The OS usually has two broad operating modes:

  • Kernel mode: privileged execution mode in which the operating system can execute sensitive instructions and directly control hardware.
  • User mode: restricted mode in which application programs execute without unrestricted access to hardware or other programs.

This separation improves safety. For example, a faulty user program should not be able to overwrite the memory of another program or directly reconfigure a disk controller. When an application needs a protected service, it requests the kernel through a system call. Examples include opening a file, creating a process, allocating memory, or transmitting data through a network socket.

A typical OS provides process management, memory management, file and storage management, device management, networking, security, and user-interface services. These functions are interconnected. Reading a sensor, for example, may involve an application, a system call, a device driver, an interrupt handler, and a hardware interface.

Layered operating system architecture Applications Libraries and system calls Kernel: processes, memory, files, networking, security device drivers and interrupt handling Hardware: CPU, memory, storage, sensors and actuators
Layered operating system architecture
Figure: Layered operating system architecture

Figure: The operating system mediates between applications and physical hardware.

2. Processes, Threads, and Scheduling

A program is a passive set of instructions stored on storage. A process is an executing instance of a program, together with its address space, registers, open files, and operating-system resources. A process may be in states such as new, ready, running, blocked, or terminated.

A thread is a path of execution within a process. Threads in the same process share code, data, and open resources, but each thread has its own program counter, registers, and stack. Multiple threads can improve responsiveness and permit independent activities such as sensor acquisition, user-interface updates, and network communication. They also introduce risks, including race conditions and deadlock.

Concurrency means that multiple activities make progress during overlapping time intervals. Parallelism means that activities execute simultaneously, normally on different processor cores. A single-core system can provide concurrency by rapidly switching between tasks, but it cannot execute two instructions at exactly the same instant.

The OS uses a scheduler to choose which ready process or thread receives CPU time. Common scheduling approaches include:

  • First-come, first-served: simple, but a long task can delay many short tasks.
  • Priority scheduling: urgent tasks receive preference, although low-priority tasks may suffer starvation.
  • Round robin: each ready task receives a time quantum, supporting interactive systems.
  • Real-time scheduling: tasks are ordered according to deadlines or timing constraints.

Important performance measures include response time, waiting time, turnaround time, throughput, and deadline-miss rate. In a control system, average performance is not sufficient: a late control task can destabilize a physical process even if most executions are fast.

A context switch occurs when the OS saves the state of one thread and restores the state of another. Context switches support multitasking but consume time and may reduce cache efficiency. A race condition occurs when the result depends on the unpredictable timing of concurrent operations. Mutual exclusion mechanisms such as mutexes, semaphores, and monitors protect shared data. Poorly designed locking can produce deadlock, in which tasks wait indefinitely for resources held by one another.

3. Memory Management

The OS allocates memory to processes and prevents one process from improperly accessing another. Modern systems normally use virtual memory, in which each process sees a private virtual address space. The memory-management unit translates virtual addresses into physical addresses using page tables and hardware translation mechanisms.

Memory is divided into fixed-size pages, while physical memory is divided into frames. A virtual page may be placed in any available physical frame. If a required page is not in physical memory, a page fault occurs. The OS may load it from secondary storage, although this is much slower than ordinary memory access.

Virtual memory provides isolation, relocation, and the ability to run programs whose combined virtual address spaces exceed physical memory. However, excessive page faults can cause thrashing, where the system spends most of its time moving pages rather than executing useful work.

Programs commonly use regions such as:

  • Code or text: machine instructions.
  • Data: global and static variables.
  • Heap: dynamically allocated memory.
  • Stack: function calls, local variables, and return information.

A memory leak occurs when a program loses the ability to release allocated memory. A buffer overflow occurs when data is written beyond the intended boundary of a buffer. Both can cause crashes or security vulnerabilities.

For real-time embedded systems, dynamic allocation may be restricted because allocation time and fragmentation can be unpredictable. Static allocation, bounded data structures, and preallocated memory pools are often preferred when deterministic timing is essential.

4. File and Storage Management

A file is a named collection of data managed by the OS. A directory organizes files and other directories into a hierarchical namespace. File systems maintain metadata such as ownership, permissions, size, timestamps, and storage locations.

Common file operations include create, open, read, write, seek, close, and delete. Applications normally do not control individual disk sectors directly. Instead, they use file-system abstractions that improve portability and permit the OS to manage buffering, caching, allocation, and protection.

File permissions commonly distinguish the owner, members of a group, and other users. Permissions may include reading, writing, and executing. Strong systems also use access-control lists, encryption, auditing, and authentication.

Storage technologies differ in speed, capacity, endurance, and failure behavior. Volatile memory loses data when power is removed, whereas nonvolatile storage retains data. Solid-state drives have no mechanical head but contain flash memory with finite write endurance. Industrial systems may require redundant storage, transaction-safe file systems, periodic backups, and recovery procedures.

A distinction must be made between reliability and availability. Reliability concerns failure-free operation over time; availability concerns whether a service is operational when needed. Redundancy can improve availability, but it does not eliminate the need for diagnosis and maintenance.

5. Device Drivers and Input/Output

A device driver is software that allows the OS to communicate with a particular hardware device. The driver translates generic operations, such as read or write, into device-specific commands. Drivers may manage disks, displays, network interfaces, USB devices, cameras, motor controllers, and sensors.

Input/output can be controlled through polling or interrupts. In polling, the CPU repeatedly checks whether a device requires attention. Polling is simple and sometimes appropriate for high-speed, predictable control loops, but it can waste processor time. With an interrupt, the device signals the CPU when an event occurs. The OS temporarily suspends current execution, runs an interrupt service routine, and then resumes the interrupted task.

Direct memory access (DMA) allows a device controller to transfer data directly to or from memory with limited CPU intervention. DMA improves throughput but requires careful buffer ownership, synchronization, and memory protection.

In mechatronics, driver design must consider electrical interfaces, timing, units, calibration, error states, and fail-safe behavior. A software driver that reports a sensor value without indicating whether the sensor is disconnected can cause unsafe decisions. Drivers should expose diagnostic information and validate data ranges where appropriate.

6. User Interfaces and Command-Line Tools

A graphical user interface (GUI) uses windows, menus, icons, buttons, and visual feedback. GUIs are effective for exploration and operator interaction, but repetitive tasks may be slow and difficult to reproduce precisely.

A command-line interface (CLI) accepts textual commands through a shell. CLI tools are powerful for automation, remote administration, scripting, and reproducible workflows. Typical tasks include listing files, changing directories, searching text, viewing processes, inspecting network connections, and managing permissions.

A shell command generally consists of a program name, options, arguments, and sometimes input/output redirection. Pipes allow the output of one command to become the input of another. This composition supports small tools that perform focused tasks. However, scripts must validate inputs, handle errors, quote untrusted data correctly, and avoid exposing credentials.

Both interfaces are important professionally. A field engineer may use a GUI to observe a robot and a CLI through a secure remote connection to inspect logs or restart a service. Accessibility also matters: interfaces should support keyboard navigation, readable text, assistive technologies, and clear status information.

7. Virtualization and Containers

Virtualization presents an abstract computing environment that differs from the underlying hardware. A virtual machine (VM) emulates or virtualizes a complete computer, including a virtual CPU, memory, storage, and devices. A hypervisor manages VMs and controls their access to physical resources.

Type 1 hypervisors run directly on hardware, whereas Type 2 hypervisors run above a host operating system. VMs provide strong isolation, support legacy software, and allow several operating systems to share one physical server. Their disadvantages include memory overhead, configuration complexity, and possible performance or timing variation.

A container isolates application processes while sharing the host operating system kernel. Container images package application code, libraries, and configuration in a repeatable form. Containers usually start faster and use fewer resources than VMs, but they do not provide exactly the same isolation boundary. A vulnerability in the shared kernel may affect multiple containers.

Virtualization is valuable for server consolidation, testing, continuous integration, and deployment. It must be used cautiously in hard real-time control, where scheduling jitter and resource contention may violate timing requirements. A real-time hypervisor or dedicated controller may be more appropriate.

8. Computing Platforms

The term computing platform refers to a combination of hardware, operating system, software environment, interfaces, and operational constraints.

PlatformTypical strengthsTypical constraintsExamples of use
Desktop/workstationRich interfaces, high performance, extensibilityPower, cost, and maintenanceCAD, simulation, programming
MobileMobility, sensors, wireless communicationBattery, thermal limits, restricted background executionOperator panels, field data collection
Server/cloudHigh capacity, centralized management, scalabilityNetwork dependence, security exposure, latencyDatabases, analytics, coordination
EmbeddedLow power, dedicated function, close hardware controlLimited resources, specialized developmentMotor control, appliances, instruments
Real-time controllerPredictable timing and deterministic responseLess flexibility and smaller software ecosystemSafety and motion-control loops

Desktop and Workstation Platforms

Desktop systems support general-purpose multitasking, high-resolution displays, development tools, and engineering applications. They are suitable for simulation, computer-aided design, data analysis, and software development. Their operating systems emphasize usability, compatibility, security updates, and support for diverse peripherals.

Mobile Platforms

Mobile systems integrate touchscreens, cameras, inertial sensors, location services, wireless radios, and power management. Applications are commonly sandboxed, and the OS may suspend background tasks to conserve energy. A mobile application controlling equipment should not assume uninterrupted connectivity; it should display communication status and handle stale or missing data safely.

Server Platforms

Servers provide shared services such as web applications, databases, authentication, file storage, and message processing. They emphasize availability, scalability, monitoring, backup, access control, and remote administration. Server applications may be distributed across multiple machines, so engineers must consider network latency, partial failure, time synchronization, and data consistency.

Embedded and Real-Time Platforms

Embedded systems are designed for a particular product or function. They may use a microcontroller operating without a conventional desktop interface, a real-time operating system (RTOS), or embedded Linux. An RTOS generally provides scheduling and synchronization services with timing behavior designed to be predictable. “Real-time” does not mean merely fast; it means that correctness depends partly on producing results within specified timing constraints.

A hard real-time deadline must not be missed, whereas a soft real-time deadline permits occasional lateness with reduced quality. A motor-control loop may have a hard deadline, while video display may be soft real-time.

9. Selecting an Operating System and Platform

Platform selection should begin with requirements rather than familiarity. Important questions include:

  1. What response time and jitter are acceptable?
  2. Must the system operate with limited power or memory?
  3. Is a graphical interface required?
  4. Which sensors, actuators, buses, and protocols must be supported?
  5. What are the safety, cybersecurity, update, and maintenance requirements?
  6. Can the system tolerate network or storage failure?
  7. Are development tools and qualified personnel available?

For example, a laboratory robot may use a desktop workstation for model development, an embedded Linux computer for camera processing, a microcontroller for deterministic motor control, and a server for experiment records. This division places each task on a platform suited to its constraints.

10. Illustrative Case: A Networked Conveyor Inspection System

Background

Consider a fictional manufacturing cell that inspects packages on a conveyor. A camera identifies defects, an encoder measures belt position, a controller drives a reject actuator, and an operator monitors production from a tablet.

Problem

The first design used one general-purpose computer for image processing, motor control, user-interface functions, and database communication. Under heavy image-processing load, actuator commands were delayed. Network interruptions also caused the operator display to show old status information.

Analysis

The system had conflicting requirements. Image processing required substantial computation, while actuator control required predictable timing. The tablet and database depended on a network and could tolerate occasional delays, but the reject actuator could not tolerate unbounded delay.

Approach and Solution

The design was divided into layers:

  • A microcontroller executed the encoder and actuator control loop.
  • An embedded computer acquired images and sent inspection results to the controller using a defined protocol.
  • A server stored production records and supplied dashboards.
  • The tablet displayed current status, communication health, and alarm states.

The controller accepted only validated commands, applied timeout rules, and moved the actuator to a safe state when communication failed. The inspection computer used a service process for image acquisition and a separate process for communication. Logs included timestamps, device identifiers, command results, and fault codes.

Outcome

Separating deterministic control from computationally intensive and network-dependent work reduced timing variation and made faults easier to diagnose. The architecture also permitted the image-processing software and operator interface to be updated without changing the fundamental actuator-control logic.

Learning Points

The case illustrates that an operating system is part of a system architecture, not merely a background utility. Platform selection should reflect timing, safety, computational, communication, and maintenance requirements. A high-performance general-purpose OS is not automatically suitable for every control task.

11. Security, Safety, and Governance

Operating-system security includes authentication, authorization, isolation, secure updates, logging, encryption, and vulnerability management. The principle of least privilege states that a process should receive only the permissions necessary for its task. Default passwords, unnecessary services, unpatched drivers, and excessive administrator access create avoidable risks.

Cybersecurity and functional safety overlap but are not identical. Safety asks whether failures can harm people, equipment, or the environment. Security asks whether intentional or unauthorized actions can compromise confidentiality, integrity, or availability. A networked actuator may require both fail-safe behavior and authentication of commands.

Engineers should define update procedures before deployment. Updates must be tested against drivers, timing behavior, data formats, and recovery mechanisms. Critical systems may require signed software, rollback images, protected boot processes, and documented change control.

Data governance is also relevant. Logs and sensor data may contain personal, operational, or commercially sensitive information. Collection should be limited to legitimate purposes, access should be controlled, and retention should be defined. Artificial intelligence systems running on platforms must additionally address data quality, model updates, explainability, and the consequences of incorrect predictions.

12. Contemporary Developments and Limitations

Modern platforms increasingly combine edge computing, cloud services, hardware accelerators, heterogeneous processors, and container orchestration. Edge processing can reduce latency and bandwidth use, while cloud computing enables large-scale storage and analysis. However, distributed systems introduce synchronization problems, network failures, expanded attack surfaces, and more complex testing.

Hardware acceleration using graphics processors, neural-processing units, or field-programmable gate arrays can improve performance for image and signal processing. The benefits depend on suitable algorithms, data-transfer overhead, development tools, and power budgets.

No operating system is universally best. General-purpose systems offer flexibility and extensive software ecosystems but may provide less timing predictability. Small embedded systems can be efficient and deterministic but may be harder to update and secure. Containers improve deployment consistency but share kernel risks. Virtual machines improve isolation but consume more resources. Engineering decisions must therefore be evidence-based and tied to explicit requirements.

Best Practices

  • Separate safety-critical control from noncritical user-interface and analytics functions.
  • Use process and memory isolation to limit faults.
  • Protect shared data with well-designed synchronization mechanisms.
  • Avoid uncontrolled dynamic allocation in hard real-time tasks.
  • Treat device drivers as safety- and security-relevant components.
  • Monitor timing, memory use, storage capacity, and fault rates.
  • Use least privilege, secure authentication, encrypted communication, and timely updates.
  • Design for loss of power, network communication, sensors, and storage.
  • Record diagnostic events with reliable timestamps and meaningful fault codes.
  • Test normal operation, overload, recovery, and adversarial conditions.

Chapter Summary

An operating system manages computing resources and provides abstractions through which applications use hardware. Processes are executing programs, while threads are execution paths that share a process’s resources. Scheduling enables concurrency, but synchronization is required to prevent races and deadlock. Virtual memory provides isolation and flexible address spaces, while file systems organize persistent information and permissions.

Device drivers connect general operating-system services to specific hardware. GUIs support interactive use, whereas command-line tools support automation and remote administration. Virtual machines virtualize complete computers; containers isolate applications while sharing a kernel. Desktop, mobile, server, embedded, and real-time platforms differ in performance, power, timing, reliability, and maintenance requirements.

For mechatronics applications, platform selection must be based on timing, safety, communication, computation, power, and lifecycle requirements. Robust systems separate deterministic control from less predictable tasks, protect resources, provide diagnostics, and address cybersecurity and ethical data governance.

Key Terms

Operating system: Software that manages hardware resources and provides services to applications.

Kernel: The privileged core of an operating system.

System call: A controlled request by a user program for an operating-system service.

Process: An executing program together with its resources and address space.

Thread: An execution path within a process.

Concurrency: Overlapping progress of multiple activities.

Parallelism: Simultaneous execution of activities on multiple processing units.

Scheduler: An operating-system component that selects tasks for execution.

Virtual memory: An address-space abstraction that maps virtual addresses to physical memory.

Page fault: An event occurring when a required virtual-memory page is not currently resident in physical memory.

File system: Software that organizes, stores, protects, and retrieves files.

Device driver: Software that translates general OS requests into device-specific operations.

Interrupt: A signal requesting processor attention from hardware or software.

Virtual machine: A software-defined computer environment managed by a hypervisor.

Container: An isolated application environment sharing the host kernel.

Real-time system: A system whose correctness depends partly on meeting timing constraints.

Embedded system: A specialized computer integrated into a product or device.

Race condition: A timing-dependent error caused by unsynchronized concurrent access.

Deadlock: A state in which tasks wait indefinitely for resources held by one another.

Least privilege: The practice of granting only the permissions required for a task.

Review Questions

Short Answer Questions

  1. What is the difference between a program and a process?
  2. Why does an operating system use user mode and kernel mode?
  3. What is the purpose of a device driver?
  4. Distinguish concurrency from parallelism.
  5. Why may dynamic memory allocation be restricted in hard real-time systems?

Long Answer Questions

  1. Explain how process management, memory management, and file management cooperate when an application reads data from storage.
  2. Compare graphical user interfaces and command-line interfaces in engineering practice.
  3. Explain virtual machines and containers, including their major advantages and limitations.
  4. Compare desktop, server, mobile, and embedded platforms using performance, power, reliability, and interface requirements.
  5. Describe how cybersecurity and functional safety should influence operating-system selection for an industrial controller.

Analytical / Application Questions

  1. Design a platform architecture for a robotic inspection cell containing a camera, motor controller, operator display, and production database. Justify the division of functions.
  2. A control task occasionally misses its deadline when image processing begins. Analyze possible operating-system causes and recommend corrective actions.
  3. An embedded device must operate for five years with intermittent network access. Propose memory, storage, update, logging, security, and recovery practices for the design.

Multiple Choice Questions with Answers

Question 1

Which component executes privileged operations and manages hardware resources?

A. Application program

B. Kernel

C. Text editor

D. Container image

Correct Answer: B. Kernel

Question 2

What is the main distinction between a process and a thread?

A. A process is always faster than a thread

B. Threads cannot execute concurrently

C. Threads are execution paths within a process and share many process resources

D. Processes do not have memory

Correct Answer: C. Threads are execution paths within a process and share many process resources

Question 3

What is a likely consequence of excessive page faults?

A. Thrashing

B. Permanent parallelism

C. Improved battery capacity

D. Automatic device calibration

Correct Answer: A. Thrashing

Question 4

What is the primary role of a device driver?

A. To replace the CPU

B. To translate general OS requests into device-specific operations

C. To encrypt every file automatically

D. To design application interfaces

Correct Answer: B. To translate general OS requests into device-specific operations

Question 5

Which statement correctly describes a container?

A. It always virtualizes a complete hardware computer

B. It normally shares the host operating-system kernel

C. It cannot isolate applications

D. It requires a separate physical server

Correct Answer: B. It normally shares the host operating-system kernel

Question 6

Which platform is generally most appropriate for a tightly timed motor-control loop?

A. A deterministic real-time controller

B. A presentation tablet

C. A public web browser

D. A file server alone

Correct Answer: A. A deterministic real-time controller

Question 7

A race condition occurs when:

A. A disk has no free space

B. The result depends on the timing of unsynchronized concurrent operations

C. A user changes a password

D. A process terminates normally

Correct Answer: B. The result depends on the timing of unsynchronized concurrent operations

Question 8

Which practice follows the principle of least privilege?

A. Giving every service administrator access

B. Disabling authentication for local users

C. Granting a process only the permissions required for its task

D. Running all applications as the system administrator

Correct Answer: C. Granting a process only the permissions required for its task

Question 9

Why can a general-purpose operating system be unsuitable for a hard real-time task?

A. It cannot execute instructions

B. Its scheduling and system-service delays may be insufficiently predictable

C. It cannot use memory

D. It cannot communicate with devices

Correct Answer: B. Its scheduling and system-service delays may be insufficiently predictable

Question 10

Which design best separates conflicting requirements in a networked conveyor inspection system?

A. Use one unmonitored process for every function

B. Place deterministic actuator control on a controller and noncritical analytics on other platforms

C. Remove all fault handling

D. Run the actuator only from a tablet interface

Correct Answer: B. Place deterministic actuator control on a controller and noncritical analytics on other platforms

Introduction to Computing
Chapter 4 of 15