Skip to content
Tutorials Center
My learning

Topics

Lesson 23 of 55 ยท Operating Systems

Types of Operating Systems

Compare batch, time-sharing, real-time, distributed, embedded and mobile operating systems, and see in Python why a real-time system cares about deadlines.

Every computer needs an operating system, but not every operating system has the same job. The one in a pacemaker, the one in a phone and the one running a bank's servers all manage hardware and run programs, yet they are built around very different goals. A phone OS wants long battery life and a smooth touch screen. A server OS wants to serve thousands of requests at once. A medical device wants to react within a guaranteed fraction of a second.

This lesson groups operating systems by the way they are used and shows what each type optimizes for. If you have not yet read What an Operating System Does, start there; the types below are all variations on those basic duties.

Six kinds of operating system

Batch Queue the jobs, run them in turn.
Time-sharing Many users take quick turns.
Real-time Answer before the deadline.
Distributed Many machines act as one.

Embedded and mobile systems are covered later in the lesson.

1 / 2

Batch operating systems

In the earliest computers a person prepared a job (a program plus its data, on punched cards or tape) and handed it to an operator. The operator collected similar jobs into a batch and the machine ran them one after another with no human interaction. The OS had a simple task: load the next job, run it to the end, print the results, repeat.

The goal is to keep an expensive machine busy. The drawback is that you wait. If you submit a job and it contains a typo, you may learn about it hours later. You rarely see pure batch systems on desktops today, but the idea lives on in batch processing on servers: a company may run payroll, billing or a nightly data export as a job that starts on a schedule with nobody watching.

Time-sharing (multitasking) systems

When computers got fast enough, designers realized the CPU was idle while a person thought or typed. Why not let many people share the machine? A time-sharing system gives each user or program a short time slice in turn, so switching is so fast that everyone feels they have the computer to themselves. This is the round-robin scheduling described in Processes, Threads and Scheduling.

Today's desktop and laptop systems (Windows, macOS, Linux) are time-sharing systems. Even a single-user laptop runs many programs at once: a browser, a music player, background updates. The goal is good response time: when you click, something should happen quickly.

Real-time operating systems

A real-time operating system (RTOS) is judged not by average speed but by whether it meets deadlines. A car's airbag controller must react within milliseconds of a crash. A robot arm must stop moving when a sensor fires. Being right but late counts as being wrong.

Real-time systems come in two flavors:

  • Hard real-time: missing a deadline is a failure, possibly a dangerous one. Examples: anti-lock brakes, flight controllers, pacemakers.
  • Soft real-time: a missed deadline lowers quality but is not a disaster. Examples: video playback (a late frame causes a stutter) or a game.

To meet deadlines, an RTOS uses scheduling rules that put the most urgent task first, instead of fair turns. A well-known rule is earliest deadline first (EDF): always run the task whose deadline is nearest. The program below compares simple first-come-first-served order with EDF for four tasks that all arrive at time 0.

Python Deadlines: first come first served versus earliest deadline first

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With first-come-first-served, the brake sensor waits behind a log message and misses its 5 ms deadline. With EDF, every task meets its deadline, even though the total work is identical. Real-time kernels such as FreeRTOS, VxWorks or QNX follow this thinking: they keep the code small and predictable, and avoid anything with unpredictable timing.

Embedded operating systems

An embedded system is a small computer built into another device: a thermostat, a router, a smart TV, a microwave, a car. Its OS (or sometimes just a single program with no OS at all, called firmware) is designed for limited memory, low power and one fixed job. Many embedded systems use a real-time kernel. Others use trimmed-down Linux. You do not install apps on most of them; the manufacturer ships updates.

Mobile operating systems

Android and iOS are mobile operating systems. They are time-sharing systems too, but they are tuned for touch screens, sensors, cameras, constant network connections and, above all, battery life. Apps are usually sandboxed: each app runs in a restricted area and must ask permission before using the camera, location or contacts. The OS may pause or close apps in the background to save power and memory. We look at the hardware these systems run on in Smartphones, Tablets and the Internet of Things.

Network and distributed operating systems

A network operating system is built to serve other computers: file sharing, printing, user accounts and web hosting. Windows Server and server editions of Linux are common examples. They emphasize reliability, security and handling many connections at once, and they often run for months without a restart.

A distributed operating system goes further: it makes a group of separate computers behave like one system. Users and programs do not care which machine runs a task or stores a file; the system spreads work and recovers if one machine fails. Large web services and cloud platforms work in this spirit (see Cloud Computing Basics), although most are built from ordinary server operating systems plus software layers on top, rather than a single special OS.

flowchart TB
  OS["Operating system goals"] --> A["Throughput<br/>batch, servers"]
  OS --> B["Response time<br/>desktop, laptop"]
  OS --> C["Deadlines<br/>real-time, embedded"]
  OS --> D["Battery and touch<br/>mobile"]
  OS --> E["Scale and fault tolerance<br/>distributed, cloud"]

Different kinds of operating system are mostly different answers to "what matters most here?"

Many real systems blend types. Linux runs phones (as part of Android), servers, routers and supercomputers. The category describes how a system is used more than which product it is.

macOS, iOS and Android compared

Most people meet three families of consumer operating systems besides Windows (see Windows at a Glance): macOS for Apple computers, iOS (and iPadOS) for Apple phones and tablets, and Android for most other phones and tablets. They show different answers to the same design questions.

macOS runs on Apple's laptops and desktops. It is a Unix-based system, which gives it a real command line and good tools for developers. It has the Finder (file manager), a Dock for apps, a menu bar at the top of the screen and a Command key for shortcuts. Apps come from the Mac App Store or directly from developers (with signing and notarization checks). Apple designs both the hardware and the software, so they work closely together.

iOS (iPhone) and iPadOS (iPad) share a kernel and a lineage with macOS but are designed for touch. Apps come almost entirely from Apple's App Store, which Apple reviews; each app runs in a strict sandbox, so it can touch only its own data unless you grant permission. Updates reach all supported devices at about the same time, because one company controls hardware and software.

Android is built by Google on top of the Linux kernel, and its core is open source. Many manufacturers (Samsung, Google, Xiaomi, Motorola and others) install it on devices of every price, and add their own look and features. Apps come from Google Play, other stores, or direct downloads (called sideloading, which carries more risk). Because there are so many makers and models, update timing and features vary widely.

macOS iOS / iPadOS Android
Made by Apple Apple Google, customized by device makers
Runs on Mac computers iPhone, iPad Phones, tablets, TVs, watches, cars (many brands)
Kernel base Unix (Darwin) Unix (Darwin) Linux
Source code Mostly closed Closed Core open (AOSP), vendor parts closed
App store Mac App Store plus direct downloads App Store (strict review) Google Play plus others, sideloading allowed
Interface Mouse, trackpad, keyboard Touch Touch
Customization Moderate Limited High
Updates From Apple, for supported Macs From Apple, quick and widespread Varies by maker; security patches may lag
Price range of devices Premium Premium From very cheap to premium
Strength Creative and development work, integration with other Apple devices Simplicity, privacy controls, long support Choice, price range, openness

Ecosystems

Each system works best with its own family of products. Apple's ecosystem shares photos, messages, passwords and files across iPhone, iPad, Mac and Watch (iCloud, AirDrop, Handoff). Google's does the same through a Google account on Android, Chromebooks and the web. The convenience is real, and so is lock-in: the more you invest in one ecosystem (purchased apps, stored photos, subscriptions), the harder it is to switch. When you choose a phone, you are also choosing a family of services.

Choosing

  • Want the simplest experience and long software support, and already own Apple devices: iPhone, iPad, Mac.
  • Want choice of device and price, or customization: Android.
  • Need a tool for software development or creative work: macOS or Linux are popular, and Windows works well too.
  • Using a shared school or office computer: whatever the organization provides; your files and accounts matter more than the logo.

All three follow the OS jobs you already know: they manage the CPU, memory, storage and devices, run apps as processes, protect them from each other and provide a user interface. See Mobile Devices and the Internet of Things for how phones differ in hardware.

Python Which system fits these needs?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What defines a hard real-time system?

    Hard real-time systems must respond within a guaranteed time; a late answer is a wrong answer.
  2. 2. Which type of OS lets many users or programs take short turns on the CPU?

    Time-sharing rapidly switches between tasks, so everyone feels they have the machine to themselves.
  3. 3. A company runs its payroll calculation every night at 2 a.m. with nobody watching. Which idea is that closest to?

    A job queued and run to completion without interaction is batch processing.
  4. 4. Why do mobile operating systems sandbox apps and close background ones?

    Sandboxing limits what an app can touch, and closing idle apps saves power and memory.
  5. 5. In the scheduling example, why did earliest deadline first help?

    The total work was the same; only the order changed, and urgent tasks went first.

Summary

  • Batch systems queue jobs and run them without interaction; the idea survives in scheduled server jobs.
  • Time-sharing systems (desktops, laptops) give everyone quick turns for good response time.
  • Real-time systems care about deadlines, not average speed. Hard real-time means a miss is a failure; soft real-time tolerates some misses.
  • Embedded, mobile, network and distributed systems each tune the same basic OS duties for their setting.
  • Earliest deadline first is a simple real-time scheduling rule that runs the most urgent task next.

Continue with Processes, Threads and Scheduling.