Home / Notes / Class 11 / Computer Science / Operating systems

Operating systems: Class 11 Computer Science

Written by Usman Tariq (Computer Science)

Role and types of operating systems, their functions, process and CPU scheduling, memory management with paging, file systems, device management, user interfaces, and common systems such as Windows, Linux and Android.

Key points

An operating system (OS) is system software that manages the hardware and software of a computer and gives users and programs a way to use them. It sits between the user, the application programs and the hardware. Examples are Windows, Linux, macOS and Android.

Main goals of an OS:

  • Convenience: make the computer easy to use.
  • Efficiency: use the CPU, memory and devices well.
  • Resource sharing: let many programs and users share one machine safely.

Types of operating systems:

  • Batch: similar jobs are collected and run together with no user interaction.
  • Multiprogramming: several programs are kept in memory so the CPU never stays idle.
  • Time-sharing (multitasking): the CPU switches quickly among programs, so each user feels it is theirs alone.
  • Multiuser and multiprocessor: many users at once, or more than one CPU.
  • Real-time: gives a result within a fixed time. Used in aircraft control and medical machines.
  • Distributed and network: many computers work together or share resources.

Functions of an OS:

  • Process management: creating, scheduling and ending processes.
  • Memory management: giving memory to programs and taking it back.
  • File management: storing, naming, protecting and finding files.
  • Device management: controlling input and output devices through drivers.
  • Security: user accounts, passwords and permissions.
  • User interface: command line or graphical.

A program is a set of instructions stored on disk. A process is a program in execution, with its own memory, registers and state. A process moves among states: new, ready, running, waiting (blocked) and terminated. A process goes from running to waiting when it needs input or output, and from waiting to ready when that finishes.

The CPU can run only one process at a time per core, so the scheduler decides which ready process runs next. Changing from one process to another is a context switch: the OS saves the state of the old process and loads that of the new one. It takes time but no useful work is done.

CPU scheduling algorithms:

  • First Come First Served (FCFS): processes run in order of arrival. Simple, but a long job makes others wait.
  • Shortest Job First (SJF): the process with the smallest burst time runs first. It gives the least average waiting time but needs the burst time in advance.
  • Round Robin: each process gets a fixed time slice (quantum) and then goes to the back of the queue. Good for time-sharing.
  • Priority scheduling: the highest priority runs first. Low priority processes may starve.

Waiting time is the time a process spends in the ready queue. Turnaround time is the time from arrival to completion. Deadlock is a state where processes wait forever because each holds a resource another needs.

Memory management keeps track of which parts of main memory (RAM) are used. In paging, a program is split into equal pages and memory into frames of the same size, so pages can sit in any free frames. In virtual memory part of the disk acts as extra RAM, letting programs larger than RAM run. Too much swapping between RAM and disk slows the system, called thrashing.

A file system organises data on a disk into files and folders (directories). A file has a name, type, size, location and permissions. Common file systems are FAT32, NTFS, ext4 and APFS. Operations are create, open, read, write, rename and delete.

A device driver is a small program that lets the OS talk to a particular device such as a printer. Spooling stores output in a buffer on disk so the CPU need not wait for a slow printer.

A user interface may be a command line interface (CLI), where commands are typed, or a graphical user interface (GUI), with windows, icons, menus and a pointer. A CLI uses little memory and is powerful for experts, while a GUI is easier for beginners.

Study tip: For scheduling questions draw a Gantt chart first, then read off waiting times. Learn the functions of an OS as a list of six headings and give one line on each. Compare types of OS using one real example for each.

Definitions and flashcards

Say the meaning first, then open the card to check.

Operating system

System software that manages hardware and provides services to programs.

Process

A program that is being executed.

Scheduler

The part of the OS that chooses which process gets the CPU.

Context switch

Saving one process state and loading another to change the running process.

Virtual memory

Disk space used as an extension of RAM.

Paging

Dividing memory into fixed-size frames and programs into pages of the same size.

Device driver

Software that lets the OS control a specific hardware device.

Deadlock

A situation where processes wait forever for resources held by each other.

Kernel

The core part of the OS that controls hardware and processes.

Formula sheet

NameFormulaWhat it means
Turnaround timecompletion time − arrival timeTotal time a process spends in the system
Waiting timeturnaround time − burst timeTime spent waiting in the ready queue
Page numberlogical address ÷ page size (whole part)Which page an address falls in
Offsetlogical address mod page sizePosition inside the page

Short questions with model answers

These are the kind of questions asked for 2, 3 and 5 marks. Try each one before opening the answer.

Define an operating system. (2 marks)

An operating system is system software that controls the computer hardware and provides services for application programs and users. It manages processes, memory, files and devices.

What is the difference between a program and a process? (2 marks)

A program is a passive set of instructions stored on a disk. A process is a program that is loaded in memory and being executed, with its own data, registers and state. One program can create several processes.

Compare CLI and GUI. (3 marks)

A CLI needs commands to be typed. It uses little memory and is fast and flexible for trained users, but commands must be remembered. A GUI uses windows, icons and a mouse or touch. It is easy to learn, but it needs more memory and processing power.

Explain the Round Robin scheduling algorithm. (3 marks)

Each process in the ready queue is given the CPU for a fixed small time called the time quantum. If it finishes within the quantum it leaves. If not, it is stopped and placed at the end of the queue, and the next process runs. This gives all processes a fair share and quick response, so it suits time-sharing systems. A very large quantum makes it act like FCFS.

Describe the functions of an operating system. (5 marks)

The OS manages processes by creating, scheduling and ending them. It manages memory by allocating and freeing space. It manages files by storing, naming, protecting and retrieving them. It controls devices through drivers. It provides security through accounts and permissions, and a user interface to give commands.

What is virtual memory and why is it needed? (3 marks)

Virtual memory is a technique that uses part of the hard disk as if it were RAM. Only the needed pages of a program are kept in RAM and the rest stay on disk. It is needed so that programs larger than the physical RAM can run and so that many programs can be open together.

Numericals with worked steps

Three processes P1, P2, P3 arrive at time 0 with burst times 5, 3 and 8 ms. Find the average waiting time under FCFS.
  1. Order of running: P1, P2, P3
  2. P1 waits 0
  3. P2 waits 5
  4. P3 waits 5 + 3 = 8
  5. Total waiting = 0 + 5 + 8 = 13 ms
  6. Average = 13 ÷ 3 = 4.33

Answer: 4.33 ms

Using the same processes, find the average waiting time under SJF.
  1. Order by burst time: P2 (3), P1 (5), P3 (8)
  2. P2 waits 0
  3. P1 waits 3
  4. P3 waits 3 + 5 = 8
  5. Total = 11 ms
  6. Average = 11 ÷ 3 = 3.67

Answer: 3.67 ms, less than FCFS

The page size is 4096 bytes. Find the page number and offset of logical address 10000.
  1. 10000 ÷ 4096 = 2 with remainder
  2. 2 × 4096 = 8192
  3. Offset = 10000 − 8192 = 1808

Answer: Page 2, offset 1808

Common mistakes

  • Saying the OS is application software. It is system software.
  • Treating a program and a process as the same thing.
  • Mixing up waiting time and turnaround time. Waiting time = turnaround time − burst time.
  • Taking the average waiting time of FCFS in the wrong order, not in the order of arrival.
  • Confusing multitasking, where one CPU switches quickly, with multiprocessing, which uses more than one CPU.

Practise this chapter

Practice questions and timed test Printable worksheet

Previous: Programming in C