What is an operating system — exam-style exercises with your laptop, multiprogramming measured in milliseconds and the types of systems (and the extra tick that cost me points)

In the self-assessment test on the virtual campus I got a multiple-answer question: “Which are historical achievements of operating systems?”. I ticked multiprogramming, virtual memory, file systems… and, on a roll, “multi-core processors”, because it sounded modern and powerful. Result: a question I almost had right ended up at half marks. Multi-core chips are an advance in hardware, not in the OS, and in multiple-answer questions every wrong tick subtracts. Since then, before ticking, I ask myself: “did the operating system invent this?”.

This article is the practice partner of the What is an operating system theory. There’s no code to write here: there’s an interactive quiz with the IC2 exam formats (single choice, multiple choice with penalties, true or false, gaps, matching, ordering, short answer and a multiprogramming calculation), open-answer questions with their model answers, a drawing of the whole topic and the cheat sheet to revise the night before. Every question is original: they cover the same as the exam, with different wording and different data. If you’re coming from the previous topic, you also have the IP addressing and subnets exercises.

How to use this article

  1. Review the theory first (at least the summary and the drawings of the layers, multiprogramming and paging).
  2. Do the quiz without looking at anything. Press “Check” on each question: you’ll see whether you got it right and the explanation of why the correct answer is correct and why the others fail.
  3. Note down your mistakes and go back to the relevant part of the theory. Multiple-answer questions subtract as in the exam: if in doubt, don’t tick.
  4. Write the open answers yourself before opening the model answer and compare it with the “what the marker looks for” list. Finish with the cheat sheet.

Questions starting with “What is … called?” or “What was the acronym…?” are short-answer: you won’t have options to lean on. Those definitions have to be learnt by heart.

Quiz: What is an operating system

Thirty-two questions covering the whole topic in the order of the theory: definition and roles, the OS as an interface and system calls, the resource manager, multiprogramming (with a calculation), milestones and types of systems. Your mark out of 10 appears at the end.

Question 1Single choice

Which of these sentences best describes what an operating system is?

  1. The software that manages the computer’s hardware and provides an environment in which applications run
  2. The set of applications that come installed when you buy the computer
  3. The part of the hardware that starts the CPU when you switch on
  4. The program that translates source code into machine instructions
Solution

Answer: The software that manages the computer’s hardware and provides an environment in which applications run

The OS sits in the middle: below it is the hardware, which it manages and coordinates, and above it are the applications, to which it offers an execution environment. The usual traps turn it around (the software that manages applications and gives the hardware an environment) or confuse it with the hardware or with an application.

Question 2Multiple · wrong ticks subtract

Which are goals of an operating system? Tick all the correct ones.

  1. Managing the computer’s resources efficiently
  2. Making interaction with the computer easier
  3. Providing an environment to run applications
  4. Making it easier for software and hardware to evolve
  5. Replacing the user’s applications
  6. Making the hardware need no memory
Solution

Answer: Managing the computer’s resources efficiently · Making interaction with the computer easier · Providing an environment to run applications · Making it easier for software and hardware to evolve

The four goals from the notes: manage resources efficiently, make interaction easier, give applications an environment and make it easier for software and hardware to evolve (if you change the disk, your programs don’t have to change). Remember that in this question every wrong tick subtracts.

Question 3Short answer

What is the name of the part of the operating system that is running at all times while the computer is on?

Solution

Answer: kernel

It’s the kernel. System programs, such as the shell or the file explorer, come with the OS but aren’t part of the kernel: they open and close like any other program.

Question 4Match

Match each role of the operating system with what it does.

Traffic police
Facilitator
Government

Definitions:

  • Gives each one a share of the resources when needed and defines standard interfaces to share them
  • Organises resources, resolves conflicts when several ask for them and protects against errors and unwanted use
  • Offers an extended machine that hides hardware details so programming is simpler
  • Translates programs' source code into machine instructions
Solution
  • Traffic police → Organises resources, resolves conflicts when several ask for them and protects against errors and unwanted use
  • Facilitator → Offers an extended machine that hides hardware details so programming is simpler
  • Government → Gives each one a share of the resources when needed and defines standard interfaces to share them

Three metaphors for the same OS. Police: order, conflicts and protection. Facilitator: the extended machine that makes the programmer’s life easier. Government: sharing out resources and standard interfaces. The leftover option describes a compiler.

Question 5True or false

State whether each statement is true or false.

  1. System programs, such as the shell, come with the OS but are not part of the kernel.
  2. The web browser is part of the operating system.
  3. There is no single definition of operating system accepted by everyone.
  4. The OS itself does the user’s useful work, such as writing a document.
Solution
  • T — System programs, such as the shell, come with the OS but are not part of the kernel.
  • F — The web browser is part of the operating system.
  • T — There is no single definition of operating system accepted by everyone.
  • F — The OS itself does the user’s useful work, such as writing a document.

The browser is an application: it uses the OS, but it isn’t the OS. And the OS does no productive work for the user: applications do, and the OS shares out the resources so they can. As for the definition, the notes themselves warn that there isn’t a universally accepted one.

Question 6Single choice

Why does the operating system need to manage resources?

  1. Because there’s more demand than resources: processes compete for the CPU, memory or disk
  2. Because processes are scarce and resources compete for them
  3. Because the hardware can’t run any instruction without an OS
  4. Because every user needs their own hardware
Solution

Answer: Because there’s more demand than resources: processes compete for the CPU, memory or disk

Read slowly: resources are scarce and processes compete for them. The option with the words swapped is the classic trap.

Question 7Multiple · wrong ticks subtract

About the operating system seen as an interface, which statements are correct?

  1. It hides awkward hardware details
  2. It adds features the hardware doesn’t have on its own
  3. It can be seen as a layer that wraps the hardware
  4. It can be seen as a layer that wraps the applications
  5. It reduces the number of instructions the CPU has
Solution

Answer: It hides awkward hardware details · It adds features the hardware doesn’t have on its own · It can be seen as a layer that wraps the hardware

The interface view: a layer around the hardware that offers a more convenient abstract (or extended) machine, hiding what’s awkward and adding what’s missing (files, processes, windows…).

Question 8Multiple · wrong ticks subtract

Which of these are interfaces offered by an operating system?

  1. A command interpreter (CLI or shell)
  2. A graphical window interface (GUI)
  3. A natural voice or touch interface (NUI)
  4. A system call API for programs
  5. The C compiler
  6. The word processor
Solution

Answer: A command interpreter (CLI or shell) · A graphical window interface (GUI) · A natural voice or touch interface (NUI) · A system call API for programs

CLI, GUI, NUI and API are the four faces of the OS interface. User programs, however useful, are not OS interfaces.

Question 9Short answer

You open a terminal, type ls and the list of files appears. What is the program that interprets what you type usually called?

Solution

Answer: shell

It’s the shell (command interpreter, the CLI). In some OSs it lives inside the kernel and in others it’s a system program; bash is a specific shell.

Question 10Match

Who is each interface for? Match each kind of user with the environment the OS offers them.

General users
Administrators
Developers

Definitions:

  • Administration environment
  • Compilation environment
  • Execution environment
  • Programming interface
Solution
  • General users → Execution environment
  • Administrators → Administration environment
  • Developers → Programming interface

Whoever uses the computer needs to run programs; whoever administers it, to configure it; whoever programs, an API (the system calls).

Question 11Match

Match each benefit of putting an interface between programs and hardware with its example.

Usability
Security
Portability
Interoperability
Maintainability

Definitions:

  • Two systems that use the same interface can exchange information
  • Programs can't directly exploit the hardware's weak points
  • Saving a file with a click is more convenient than moving the disk head
  • The hardware runs faster when there's an interface in front of it
  • The same program works with an SSD or with a spinning disk
  • The OS is improved without forcing user programs to be rewritten
Solution
  • Usability → Saving a file with a click is more convenient than moving the disk head
  • Security → Programs can’t directly exploit the hardware’s weak points
  • Portability → The same program works with an SSD or with a spinning disk
  • Interoperability → Two systems that use the same interface can exchange information
  • Maintainability → The OS is improved without forcing user programs to be rewritten

These are the benefits from the notes (the sixth, productivity, is the sum of them all). The interface doesn’t make the hardware faster: it adds a layer, so if anything it costs a little.

Question 12Single choice

What is a system call?

  1. A public kernel service that a program requests through the OS API, usually via a library
  2. An instruction with which the program writes directly to the disk without going through the OS
  3. A command the user types in the shell
  4. A signal from the keyboard to the CPU when you press a key
Solution

Answer: A public kernel service that a program requests through the OS API, usually via a library

The OS offers developers and processes a set of public services reachable through an API: those are the system calls. They’re usually not invoked raw but through the system libraries (libc in C).

Question 13Fill in the gaps

Complete the explanation of the call n = write(fd, buffer, size).

The argument ____ is the descriptor that says which file or device is written to; ____ points to the memory area where the data is; ____ says how many bytes to write, and n receives the number of bytes ____.

Words:

  • size
  • pid
  • path
  • fd
  • read
  • written
  • buffer
Solution

The argument fd is the descriptor that says which file or device is written to; buffer points to the memory area where the data is; size says how many bytes to write, and n receives the number of bytes written.

These are the three parameters of write() and its result. Returning the bytes written matters: it may write fewer than you asked for and your program should check it.

Question 14Multiple · wrong ticks subtract

Which of these are milestones (historical achievements) of operating systems?

  1. Multiprogramming
  2. Virtual memory
  3. File systems
  4. Concurrent access control
  5. Multi-core processors
  6. High-level languages
  7. Touch screens
Solution

Answer: Multiprogramming · Virtual memory · File systems · Concurrent access control

OS milestones are ideas of the software itself: multiprogramming, paging, virtual memory, file systems, a uniform I/O interface, concurrent access control and protection and security. Whatever is hardware or languages doesn’t count.

Question 15Single choice

VS Code needs 400 MB, but only 150 MB are in RAM; the rest stays on the disk and is brought in when needed. Which OS milestone makes this possible?

  1. Virtual memory
  2. Paging
  3. Cache memory
  4. The file system
Solution

Answer: Virtual memory

Key to not mixing them up: paging = chop into pages and place them in different gaps of main memory; virtual memory = you don’t need everything in main memory, because secondary storage acts as an extension.

Question 16Single choice

The OS divides a program into pieces of the same size and places them in main memory gaps that aren’t next to each other. What is this technique called?

  1. Paging
  2. Virtual memory
  3. Multiprogramming
  4. Uniform I/O interface
Solution

Answer: Paging

Equal pieces (pages) in non-contiguous gaps of main memory: paging. If the question mentions secondary memory or the cache, be suspicious.

Question 17Fill in the gaps

Complete the text about the uniform I/O interface.

The OS offers ____ the same API to work with any device. Inside, each device has its ____, which works without the end user noticing. So the same code works for different peripherals, which gains ____, and since direct access to devices can be forbidden, there’s more ____.

Words:

  • driver
  • administrators
  • portability
  • developers
  • compiler
  • integrity
  • performance
  • security
Solution

The OS offers developers the same API to work with any device. Inside, each device has its driver, which works without the end user noticing. So the same code works for different peripherals, which gains portability, and since direct access to devices can be forbidden, there’s more security.

It’s device independence: abstraction of each peripheral’s details, portability, adaptation to future peripherals and security. Your program calls write() the same way on a USB stick as on an SSD.

Question 18Single choice

Spotify and the browser both want the sound card at the same time in an exclusive mode; the OS gives it to one and makes the other wait. Which OS milestone is this?

  1. Concurrent access control
  2. Multiprogramming
  3. Virtual memory
  4. Real time
Solution

Answer: Concurrent access control

Concurrent access control exists precisely because some resources can’t be used by several processes at once. In Topic 8 (concurrency) you’ll see how it’s implemented.

Question 19Fill in the gaps

Complete the criteria that the resource management policy must meet.

The policy must ____ system performance, share with ____ (no hogging and no ____ of the processes that lose out) and guarantee security: confidentiality, ____ and availability.

Words:

  • optimise
  • fairness
  • effectiveness
  • velocity
  • starvation
  • integrity
  • precision
  • speed
Solution

The policy must optimise system performance, share with fairness (no hogging and no starvation of the processes that lose out) and guarantee security: confidentiality, integrity and availability.

Performance, fairness and security (CIA). Careful: they conflict. If you give all the CPU to the compiler so it finishes sooner (performance), Spotify gets no turn (fairness).

Question 20Match

Match each element of security (CIA) with the situation it protects.

Confidentiality
Integrity
Availability

Definitions:

  • The laptop boots in less than ten seconds
  • Nobody else can read the notes you keep in your folder
  • The virtual campus keeps working the night before the deadline
  • The downloaded PDF arrives identical to the original, not corrupted
Solution
  • Confidentiality → Nobody else can read the notes you keep in your folder
  • Integrity → The downloaded PDF arrives identical to the original, not corrupted
  • Availability → The virtual campus keeps working the night before the deadline

Confidentiality = privacy; integrity = information isn’t corrupted or degraded; availability = the system keeps providing service. Booting fast is performance, not security.

Question 21Single choice

What does a resource management policy have to decide?

  1. Which process gets each resource, how much, at what moment and for how long
  2. Which user gets each resource and how much money it costs
  3. Which programs can be installed on the computer
  4. What hardware to buy when memory runs out
Solution

Answer: Which process gets each resource, how much, at what moment and for how long

Policies share resources among processes: which one, how much, when and for how long. Swapping “process” for “user” is a typical trap.

Question 22Multiple · wrong ticks subtract

What does the operating system manage? Tick everything that’s correct.

  1. Processes
  2. Memory
  3. Files and mass storage
  4. Input/output devices and the cache
  5. Protection and security
  6. The applications’ source code
  7. The circuit design of the motherboard
Solution

Answer: Processes · Memory · Files and mass storage · Input/output devices and the cache · Protection and security

The list from the notes: processes, memory, files, mass storage, cache, I/O devices and protection and security. Topics 6 to 11 are these managers one by one.

Question 23Multiple · wrong ticks subtract

About multiprogramming on a computer with a single CPU, what is true?

  1. When a process blocks waiting for its I/O, the CPU runs instructions from another one
  2. The CPU and the I/O devices work at the same time, and more jobs finish in less time
  3. It’s also known as multitasking
  4. Processes run truly in parallel inside the single CPU
  5. It needs a processor with several cores
  6. The user decides by hand which process uses the CPU at each moment
Solution

Answer: When a process blocks waiting for its I/O, the CPU runs instructions from another one · The CPU and the I/O devices work at the same time, and more jobs finish in less time · It’s also known as multitasking

The idea: make use of I/O waits. Processes run concurrently (interleaved), not in parallel. Look at the simulator in the theory: with the same CPU work, from 39% to 74% usage.

Question 24Calculation

Two programs on a laptop with one CPU. A: CPU 30 ms, I/O 30 ms, CPU 30 ms. B: CPU 20 ms, I/O 20 ms, CPU 20 ms. A starts; each I/O goes to its own device. Work out the total time, the CPU busy time and the CPU usage (rounded to a whole number) without and with multiprogramming.

ModeTotal time (ms)CPU busy (ms)CPU usage (%)
One after another
Multiprogrammed
SolutionABAB030506090110
ModeTotal time (ms)CPU busy (ms)CPU usage (%)
One after another15010067
Multiprogrammed11010091

CPU busy time doesn’t change: 30 + 30 + 20 + 20 = 100 ms in both cases.

One after another: A takes 30 + 30 + 30 = 90 ms and then B takes 20 + 20 + 20 = 60 ms; total 150 ms and usage 100 / 150 = 66.7% ≈ 67%.

Multiprogrammed (the drawing is the CPU): A uses the CPU from 0 to 30 and goes to its I/O until 60. B gets in from 30 to 50 and goes to its I/O until 70. From 50 to 60 the CPU is idle: both are waiting for their I/O. A comes back from 60 to 90; B, ready since 70, waits and gets in from 90 to 110. Total 110 ms and usage 100 / 110 = 90.9% ≈ 91%.

Question 25Fill in the gaps

Complete the new issues that appear in a multiprogrammed system (and that don’t exist without multiprogramming).

When the CPU becomes free, someone must choose which process gets it: that’s CPU ____. Processes compete for the use of ____, and the ____ of each one’s private areas must be guaranteed. Conflicts also appear when resources are accessed at the same time, along with the risk of ____.

Words:

  • cache
  • deadlock
  • printing
  • scheduling
  • compilation
  • memory
  • paging
  • protection
Solution

When the CPU becomes free, someone must choose which process gets it: that’s CPU scheduling. Processes compete for the use of memory, and the protection of each one’s private areas must be guaranteed. Conflicts also appear when resources are accessed at the same time, along with the risk of deadlock.

With a single program there’s nobody to choose, nobody to share memory with and nobody who can step on you. With several, scheduling, memory sharing and protection, conflicts and deadlocks appear.

Question 26Single choice

You have VS Code installed and you open it twice, with two independent windows. How many VS Code programs and how many processes are there?

  1. One program and two processes
  2. Two programs and two processes
  3. One program and one process
  4. No program and two processes
Solution

Answer: One program and two processes

Program = collection of instructions (passive entity). Process = program in execution (active entity). One program can give rise to several processes. (In practice VS Code also creates helper processes, but this is the idea.)

Question 27Match

Match each type of system with its characteristic.

Batch processing
Time sharing
Real time
Multi-user
Distributed

Definitions:

  • A single program that runs forever without an OS
  • Processes take turns on the CPU in short slices to provide interactivity
  • Distinguishes access profiles with different privileges
  • Several computers in a network used as if they were one
  • Runs jobs one after another with no user involvement
  • Each task has to finish before a set deadline
Solution
  • Batch processing → Runs jobs one after another with no user involvement
  • Time sharing → Processes take turns on the CPU in short slices to provide interactivity
  • Real time → Each task has to finish before a set deadline
  • Multi-user → Distinguishes access profiles with different privileges
  • Distributed → Several computers in a network used as if they were one

Batch: sequential and unattended. Time sharing: time slices and interactivity. Real time: deadlines. Multi-user: profiles and privileges. Distributed: many machines in a network used as one.

Question 28True or false

True or false about types of systems.

  1. The first operating systems, in the early 1950s, were batch processing systems.
  2. In a batch system, the user interacted with their program while it was running.
  3. A phone used by a single person can run several apps at once: it’s multitasking without being multi-user.
  4. A hard real-time system, like the one that controls a plane, usually relies on virtual memory to have more memory.
  5. Services such as Dropbox have distributed-system features, even though there’s no universal distributed system.
Solution
  • T — The first operating systems, in the early 1950s, were batch processing systems.
  • F — In a batch system, the user interacted with their program while it was running.
  • T — A phone used by a single person can run several apps at once: it’s multitasking without being multi-user.
  • F — A hard real-time system, like the one that controls a plane, usually relies on virtual memory to have more memory.
  • T — Services such as Dropbox have distributed-system features, even though there’s no universal distributed system.

Batch systems had no interaction: that was time sharing’s step forward. Hard real-time systems usually do without whatever makes timing unpredictable, like virtual memory (fetching a page from disk takes time). And multitasking ≠ multi-user.

Question 29Match

Match each multiprocessor acronym with its meaning.

SMP
AMP
UMA
NUMA

Definitions:

  • A processor with a single core and no memory of its own
  • Any task can run on any processor
  • Processors specialise: for example, one runs the OS and the rest run user processes
  • All processors share one memory with the same access time
  • Each processor has its own memory; accessing another one's is slower
Solution
  • SMP → Any task can run on any processor
  • AMP → Processors specialise: for example, one runs the OS and the rest run user processes
  • UMA → All processors share one memory with the same access time
  • NUMA → Each processor has its own memory; accessing another one’s is slower

SMP/AMP are about how tasks are shared out (symmetric or asymmetric); UMA/NUMA, about how memory is accessed (uniform or not).

Question 30Multiple · wrong ticks subtract

What are virtual machines for? Tick the correct uses.

  1. Creating protected environments isolated from each other
  2. Writing and testing applications for hardware you don’t have
  3. Keeping old systems alive, such as console games with an emulator
  4. Achieving platform independence, as Java does
  5. Running programs faster than on the real machine
  6. No longer needing any physical hardware
Solution

Answer: Creating protected environments isolated from each other · Writing and testing applications for hardware you don’t have · Keeping old systems alive, such as console games with an emulator · Achieving platform independence, as Java does

A virtual machine emulates a physical machine in software. Advantage: you don’t need the original system. Drawback: it’s slower.

Question 31Short answer

What was the acronym of the first language used to give orders to a batch operating system?

Solution

Answer: JCL

JCL, Job Control Language: it described each job in the batch (which program, which data, what to do with the output).

Question 32Order

Your program saves your notes with write(). Put what happens in order, from start to finish.

  1. The device driver writes the bytes to the disk
  2. The kernel checks the descriptor and the permissions
  3. Your process calls write() from the system library
  4. The library prepares the arguments and makes the system call
  5. write() returns the number of bytes written to your process
Solution

Correct order:

  1. Your process calls write() from the system library
  2. The library prepares the arguments and makes the system call
  3. The kernel checks the descriptor and the permissions
  4. The device driver writes the bytes to the disk
  5. write() returns the number of bytes written to your process

Your program never touches the disk: it asks and waits. Library → kernel (which checks before doing anything) → device driver → result back. It’s the OS interface in action.

In the multiprogramming calculation (question 24), adding the I/O to the “CPU busy” time as well. CPU busy time is only the CPU bursts (100 ms in both modes); the devices do the I/O. The only thing that changes between the two modes is the total time.

To tell paging and virtual memory apart (questions 15 and 16), look for the word disk or secondary memory in the question: if it’s there, it’s virtual memory; if everything happens in main memory, it’s paging.

Open-answer questions

The IC2 exam has written questions. These four cover what lends itself most to a written answer in this topic. Write your answer in the box (or on paper) and then compare with the model answer and the list of what the marker looks for.

Question 1Open answer

Explain what an operating system is and describe its two main views: as an interface and as a resource manager.

Solution

Model answer:

An operating system is the software that manages a computer’s hardware and provides an execution environment for the users’ applications. It sits between the hardware and the applications, and its central part, the kernel, is running at all times.

As an interface, the OS is a layer that wraps the hardware and offers an abstract or extended machine: it hides the awkward hardware details and adds features the hardware doesn’t have, such as files or processes. It offers interfaces to each kind of user (GUI and NUI, CLI or shell, and the system call API), and in doing so gains usability, security, portability, interoperability, maintainability and productivity.

As a resource manager, the OS acts as a referee: resources are scarce and processes compete for them, so it decides which process gets each resource, how much, when and for how long. Its policies aim for performance, fairness and security (confidentiality, integrity and availability), criteria that conflict.

What the marker looks for:

  • Correct definition: manages the hardware and gives applications an execution environment
  • Placing the OS between hardware and applications and mentioning the kernel
  • Interface view: extended machine, hiding and adding, types of interface and some benefit
  • Manager view: scarce resources, competing processes, what the policy decides
  • The criteria (performance, fairness, security) and that they conflict

A good answer doesn’t stop at the definition: it explains both views with an example of each.

Question 2Open answer

What is multiprogramming? Explain why it improves CPU usage and what new problems the operating system must solve when it uses it.

Solution

Model answer:

Multiprogramming (or multitasking) means having several processes loaded in memory at the same time so that, when one blocks waiting for an I/O operation, the CPU runs instructions from another one. With a single CPU, processes don’t run in parallel but concurrently: they interleave their execution.

It improves CPU usage because it fills the gaps left by I/O waits: the CPU and the devices work at the same time and more jobs finish in less time. For example, three programs with 140 ms of CPU take 360 ms one after another (39% usage) and 190 ms multiprogrammed (74%).

In exchange, problems appear that don’t exist with a single program: choosing which process gets the CPU when it becomes free (scheduling), sharing memory among processes, protecting each one’s private area (and the OS’s own), resolving conflicts when resources are accessed at the same time and avoiding deadlocks.

What the marker looks for:

  • Definition: several processes in memory and switching process when one waits for I/O
  • Telling concurrency (interleaving) apart from parallelism
  • Why it helps: CPU and I/O in parallel, more jobs in less time (better with an example)
  • New problems: scheduling, memory, protection, conflicts and deadlock

If you give numbers, make them add up: CPU busy time doesn’t change, what goes down is the total time.

Question 3Open answer

Explain the difference between paging and virtual memory, and why both were operating system milestones.

Solution

Model answer:

Paging divides a program into small pieces of the same size, the pages, which can be placed in different areas of main memory, which is also divided into pieces of that size. That way a program doesn’t need one huge contiguous gap: it uses whatever free gaps there are.

Virtual memory goes one step further: the program doesn’t need to be fully loaded in main memory to run. The parts that aren’t being used stay in secondary storage (the disk), which acts as an extension of main memory, and are brought in when needed.

Both are milestones because they made it possible to run more and bigger programs with the same memory, and they handle it automatically, without the user or the programmer having to step in.

What the marker looks for:

  • Paging: chopping into pages and spreading them in non-contiguous gaps of main memory
  • Virtual memory: no need to load everything; secondary memory as an extension
  • Not confusing secondary memory with the cache or mixing the two ideas
  • Why they’re milestones: more and bigger programs, transparently

The clue to keep them apart: paging only talks about main memory; virtual memory brings the disk into play.

Question 4Open answer

Compare batch, time-sharing and real-time systems: what each one aimed for and how it shares out CPU time.

Solution

Model answer:

Batch systems were the first (early 1950s). Their goal was to automate the running of jobs and increase processor use: jobs were grouped into batches and run one after another, with no user involvement. Tasks were described with JCL, and multiprogramming was added to them at the end of the 1960s.

Time-sharing systems (invented in the 1950s and commercialised in the 1960s) aimed for interactivity: each process gets a small periodic time slice and processes take turns on the CPU. If the slice is a few milliseconds, the user doesn’t notice the pauses, and the system can also be shared among many users.

Real-time systems aim for each task to finish within a fixed deadline (industrial control, multimedia), with special scheduling algorithms. In hard real-time systems, like an embedded system in a car, a missed deadline is a failure, and they usually do without services that make timing unpredictable, such as virtual memory.

What the marker looks for:

  • Batch: first, sequential and unattended, JCL, CPU usage as the goal
  • Time sharing: slices, turns, interactivity and sharing among users
  • Real time: deadlines, special scheduling, hard ones without virtual memory
  • Comparing each one’s goal, not just describing them separately

A three-column table (goal, CPU sharing, example) is also fine in the exam if you add a couple of sentences.

In an open-answer question the definition isn’t enough. What raises the mark is connecting ideas: why multiprogramming needs memory protection, or why a hard real-time system gives up virtual memory.

The whole topic in one picture

Before the cheat sheet, the full map. If you can explain each box in your own words and give an example from your laptop, you’ve got the topic:

Topic map Map with the operating system in the centre and five branches: what it is (manages the hardware, environment for applications, kernel, roles), interface (CLI, GUI, NUI, API, system calls and their benefits), resource manager (what it manages, the policy and the criteria), milestones (multiprogramming, paging, virtual memory, files, uniform I/O, concurrency, protection) and types of systems. The whole topic in one picture Operating system What it is manages the hardware environment for applications kernel always running police · facilitator · government Interface CLI (shell) · GUI · NUI · API system calls: write() usability · security portability · maintainability… Resource manager processes · memory · files I/O · cache · protection which process, how much, when performance ⇄ fairness · CIA Types batch (JCL) · time sharing real time · multi-user SMP/AMP · UMA/NUMA distributed · virtual machines Milestones multiprogramming paging · virtual memory files · uniform I/O concurrency · protection
If you can explain each box in your own words, you have the topic.

In the centre, the operating system. Top left, what it is (it manages the hardware, gives applications an environment, its kernel always runs, and the three roles). Top right, the interface (CLI, GUI, NUI, API and system calls, with their benefits). At the bottom, the resource manager (what it manages, the policy and its conflicting criteria) and the types of systems. In the middle, the milestones, which tie everything together: multiprogramming forces better management of memory and the CPU, and paging and virtual memory are the answer.

Cheat sheet: What is an operating system

The essentials in 30 seconds

  • OS: software that manages the hardware and gives applications an execution environment. The kernel is the only thing that always runs.
  • Two views: as an interface (an extended machine that wraps the hardware) and as a resource manager (a referee between competing processes).
  • Process = program in execution (active); program = instructions (passive).
  • Multiprogramming: if a process waits for I/O, the CPU runs another one. Concurrency, not parallelism.
  • Paging = chopping up in main memory; virtual memory = not loading it all, with the disk as an extension.

If they ask you…

If they ask you…Answer…Typical trap
What an OS isIt manages the hardware and gives applications an environmentTurning it around: “manages applications and gives the hardware an environment”
Why it manages resourcesResources are scarce and processes compete“Processes are scarce and resources compete”
What the policy decidesWhich process, how much, when and for how longSwapping process for user
Policy criteriaPerformance, fairness, security (CIA); in conflictThinking all of them can be maximised
What the OS layer wrapsThe hardwareSaying the software or the applications
Name of the CLIShell (command interpreter)—
What system calls arePublic kernel services requested through the API and the librariesConfusing them with shell commands or interrupts
OS milestonesMultiprogramming, paging, virtual memory, files, uniform I/O, concurrent access, protectionMulti-core, high-level languages, touch screens
First batch languageJCL—
Multi-user versus multitaskingNot the same: there can be multitasking without multi-userTreating them as synonyms

Types of systems in one table

TypeKeywordExam detail
BatchSequential and unattendedThe first ones (1950s); JCL; multiprogramming at the end of the 1960s
Time sharingSlices and interactivityInvented in the 1950s, commercialised in the 1960s; shared among users
Real timeDeadlinesHard ones do without virtual memory
Multi-userProfiles and privilegesPermissions, quotas, priorities
SMP / AMPWho runs whatAny task on any CPU / specialisation
UMA / NUMAWhere memory isShared / distributed per processor
DistributedMany machines that look like oneNo universal one; the cloud, the web
Virtual machineSoftware emulationAdvantage: no original system needed. Drawback: slower

Multiprogramming calculation template

With the data from question 24 (A: 30-30-30; B: 20-20-20, in ms):

ModeTotal timeCPU busyCPU usage
One after another90 + 60 = 150 ms30 + 30 + 20 + 20 = 100 ms100 / 150 ≈ 67%
Multiprogrammed110 ms (A 0-30, B 30-50, idle 50-60, A 60-90, B 90-110)100 ms100 / 110 ≈ 91%

Steps: add up the CPU bursts (they don’t change), draw the CPU line giving the turn to the next ready process every time one leaves for its I/O, note when each one comes back and divide CPU busy time by total time.

If you’re torn between two options…

If you’re torn between…Look at…
Paging and virtual memoryDoes the disk or secondary memory appear? Then it’s virtual memory
Multiprogramming and time sharingMultiprogramming makes use of I/O waits; time sharing hands out time slices to give interactivity
Interface and resource managerInterface = hiding and adding (extended machine); manager = sharing out and refereeing
Kernel and system programsThe kernel is always running; system programs (shell, explorer) open and close
Confidentiality and integrityCan someone who shouldn’t read it? Confidentiality. Has it been corrupted? Integrity

Before handing it in, ask yourself

  1. Have I checked whether the question talks about processes or users, resources or processes? Traps change one word.
  2. In multiple-answer questions, did the OS really invent each option I tick, or is it hardware? If in doubt, I don’t tick it.
  3. Can I tell paging from virtual memory and multi-user from multitasking?
  4. In the calculation, is CPU busy time the same in both modes and have I divided by the right total time?

With this you finish the first operating systems topic. If a question got stuck, go back to the What is an operating system theory. In the next topic we go down to the hardware that supports the OS: I/O, interrupts, the memory hierarchy and protection.

Keep goingAll Operating systems articles

Did this article help you? Here is how you can support SergioLearns →

Sigue aprendiendo

Leave a Reply

Your email address will not be published. Required fields are marked *