Chapter 5: System Software – 9618 CS AS Level Notes

5.1 Operating Systems


Why a Computer System Requires an Operating System

Definition: An Operating System (OS) is system software that manages computer hardware and software resources and provides common services for computer programs.

Purpose of an Operating System

1. Hardware Abstraction

  • Hides complexity of hardware from users and applications
  • Provides consistent interface regardless of underlying hardware
  • Example: Application can read a file without knowing disk geometry

2. Resource Management

  • Manages limited resources (CPU, memory, I/O devices)
  • Allocates resources fairly and efficiently
  • Prevents conflicts between programs

3. User Interface

  • Provides way for users to interact with computer
  • Command-line interface (CLI) or Graphical User Interface (GUI)

4. Platform for Applications

  • Provides environment where applications can run
  • Offers standard services (file access, networking)
  • Manages multitasking between applications

5. Security and Protection

  • Prevents unauthorised access to system
  • Protects programs from interfering with each other
  • Manages user authentication and permissions

What Would Happen Without an OS?

  • Every program would need its own hardware drivers
  • No multitasking (only one program at a time)
  • Programmers would need detailed hardware knowledge
  • No standard way to access files
  • No security between users/programs
  • Extremely difficult to use for average person

Key Management Tasks of an Operating System

1. Memory Management

Purpose: Manage primary memory (RAM) allocation and deallocation.

Key Functions:

FunctionDescription
AllocationAssigns memory to processes when they request it
DeallocationReclaims memory when processes finish
ProtectionPrevents processes from accessing each other’s memory
SharingAllows shared memory regions between processes
Virtual MemoryUses disk space as extension of RAM
Paging/SegmentationOrganises memory for efficiency

Techniques:

  • Fixed partitioning: Memory divided into fixed-size partitions
  • Dynamic partitioning: Variable-sized partitions as needed
  • Paging: Memory divided into fixed-size frames; processes divided into pages
  • Segmentation: Memory divided into logical segments (code, data, stack)

Example: When you open multiple applications, OS allocates memory to each, ensuring they don’t interfere.

2. File Management

Purpose: Organise and control access to data on secondary storage.

Key Functions:

FunctionDescription
File organisationStructures files into directories/folders
Naming conventionsManages file naming rules
Access methodsProvides ways to read/write files
ProtectionControls who can access which files
AllocationManages space on storage devices
Buffering/CachingImproves file access performance

File Systems Examples:

  • Windows: NTFS, FAT32, exFAT
  • Linux: ext4, XFS, Btrfs
  • macOS: APFS, HFS+

Operations:

  • Create, delete, rename files/directories
  • Open, close, read, write, seek within files
  • Set permissions (read, write, execute)
  • List directory contents

3. Security Management

Purpose: Protect system resources from unauthorised access.

Key Functions:

FunctionDescription
AuthenticationVerifies user identity (passwords, biometrics)
AuthorizationDetermines what authenticated users can do
Access controlEnforces permissions on resources
AuditingLogs security-relevant events
EncryptionProtects data confidentiality

Access Control Models:

  • DAC (Discretionary Access Control): Owners control their files
  • MAC (Mandatory Access Control): System-wide policies
  • RBAC (Role-Based Access Control): Permissions based on roles

Example: When you log into Windows, OS checks your password, then grants access based on your user account type (standard vs administrator).

4. Hardware Management (Input/Output/Peripherals)

Purpose: Control and coordinate all I/O devices.

Key Functions:

FunctionDescription
Device driversSoftware that communicates with specific hardware
BufferingTemporary storage to handle speed differences
SpoolingQueues output for slow devices (like printers)
Interrupt handlingResponds to device interrupts
Plug and PlayAutomatically detects and configures new devices

I/O Methods:

MethodDescriptionCPU Usage
Programmed I/OCPU constantly checks device statusHigh (polling)
Interrupt-driven I/ODevice interrupts CPU when readyMedium
DMA (Direct Memory Access)Device accesses memory directlyLow (CPU free)

Example: When you print, OS manages the data flow to printer, allowing other programs to continue working.

5. Process Management

Purpose: Manage execution of programs (processes).

Key Concepts:

TermDefinition
ProcessProgram in execution with its own memory space
ThreadLightweight process sharing memory with others
ProgramPassive stored code
Process Control Block (PCB)Data structure storing process information

Process States:

    ┌─────────────┐
    │    New      │
    └──────┬──────┘
           ↓
    ┌─────────────┐     Schedule     ┌─────────────┐
    │    Ready    │ ───────────────→ │   Running   │
    └─────────────┘                   └──────┬──────┘
          ↑                                    │
          │            I/O or event           │
          │            completes              │ I/O or event
          │                                    │ wait
          │                                    ↓
          │                             ┌─────────────┐
          └──────────────────────────── │   Blocked   │
                                       └─────────────┘

Key Functions:

FunctionDescription
Process creationCreates new processes
Process schedulingDecides which process runs next
Process terminationCleans up finished processes
SynchronisationCoordinates cooperating processes
Inter-process communicationAllows processes to exchange data

Scheduling Algorithms:

AlgorithmDescriptionAdvantagesDisadvantages
FCFSFirst Come First ServedSimple, fairConvoy effect (short jobs wait for long)
SJFShortest Job FirstMinimises average waitStarvation of long jobs
Round RobinEach process gets time sliceGood response timeMore overhead
PriorityHigher priority runs firstImportant tasks优先Starvation possible
Multilevel QueueMultiple queues with prioritiesFlexibleComplex

Utility Software

Definition: System software designed to help analyse, configure, optimise, or maintain a computer.

Disk Formatter

Purpose: Prepares storage devices for use.

Functions:

  • Creates file system structure (superblock, inodes, FAT)
  • Divides disk into tracks and sectors
  • Checks for bad sectors
  • Erases all existing data

Types:

  • Low-level format: Physical sector creation (rarely done by users)
  • High-level format: Creates file system (what users typically do)

Use case: Preparing a new hard drive, wiping a drive for reuse

Virus Checker / Antivirus

Purpose: Detects, prevents, and removes malicious software.

Functions:

  • Signature-based detection: Compares files against known virus patterns
  • Heuristic analysis: Looks for suspicious behaviour
  • Real-time protection: Scans files as they’re accessed
  • Quarantine: Isolates infected files
  • Scheduled scans: Regular system checks

Common features:

  • Email scanning
  • Web protection
  • Automatic updates
  • Boot-time scanning

Use case: Essential security software for all computers

Defragmentation Software

Purpose: Reorganises files on disk for contiguous storage.

Problem: Files become fragmented (stored in non-contiguous sectors) over time, slowing access.

How it works:

  1. Analyses disk fragmentation
  2. Moves file pieces to contiguous locations
  3. Consolidates free space
  4. Optimises file access speed

When needed:

  • Traditional HDDs benefit significantly
  • SSDs should NOT be defragmented (wears out flash, no benefit)
  • Modern OS may auto-defragment

Note: SSDs use TRIM command instead for performance.

Disk Contents Analysis / Disk Repair Software

Purpose: Analyses disk usage and repairs file system errors.

Disk Analysis functions:

  • Shows space usage by folder/file
  • Identifies large files
  • Visualises disk usage

Disk Repair functions:

  • Checks file system integrity
  • Recovers lost clusters
  • Repairs cross-linked files
  • Fixes directory structure errors

Examples:

  • Windows: CHKDSK, ScanDisk
  • Linux: fsck
  • Third-party: WinDirStat (analysis)

Use case: Diagnosing “disk full” issues, fixing corruption after improper shutdown

File Compression Software

Purpose: Reduces file size by encoding data more efficiently.

Functions:

  • Compresses files/folders into archives
  • Decompresses archives back to original
  • May split archives across multiple files
  • Can add password protection
  • Calculates checksums for integrity

Common formats:

  • ZIP, RAR, 7z, TAR.GZ

Use case: Reducing storage space, combining multiple files for transfer, backup

Back-up Software

Purpose: Creates copies of data for disaster recovery.

Backup types:

TypeDescriptionSpaceTimeRestore
FullCopies all selected dataMostLongestSimplest
IncrementalCopies changes since last backup (any type)LeastFastestComplex (need all since last full)
DifferentialCopies changes since last full backupMediumMediumMedium (need last full + last diff)

Backup strategies:

  • 3-2-1 rule: 3 copies, 2 media types, 1 offsite
  • Scheduled automatic backups
  • Versioning (keep multiple versions)

Use case: Protecting against data loss from hardware failure, accidental deletion, ransomware


Program Libraries

What are Program Libraries?

Definition: Collections of pre-written code that can be used by programs to perform common tasks.

Types of Libraries

Static Libraries:

  • Code copied into program at compile time
  • Becomes part of executable
  • File extensions: .lib (Windows), .a (Linux)
  • Program size larger
  • No external dependencies at runtime
  • Updates require recompilation

Dynamic Libraries:

  • Code stored in separate files
  • Loaded at runtime when needed
  • File extensions: .dll (Windows), .so (Linux), .dylib (macOS)
  • Program size smaller
  • Multiple programs can share one library
  • Can update library without recompiling programs

Benefits of Using Libraries

1. Code Reuse

  • Don’t reinvent the wheel
  • Use tested, proven code
  • Faster development

2. Reliability

  • Library code is typically well-tested
  • Fewer bugs than writing from scratch
  • Used by many applications

3. Efficiency

  • Optimised by experts
  • Platform-specific optimisations
  • Shared libraries save memory (one copy in RAM)

4. Standardisation

  • Consistent interfaces
  • Easier for developers to learn
  • Interoperability between programs

5. Maintenance

  • Bugs fixed in one place
  • Security patches applied to library
  • Updates benefit all using applications

Dynamic Link Library (DLL) Files

Definition: Microsoft’s implementation of dynamic libraries in Windows.

Characteristics:

  • .dll file extension
  • Loaded when program starts or on demand
  • Multiple programs can use same DLL simultaneously
  • Only one copy in memory (saves RAM)
  • Can be updated independently

DLL Structure:

  • Exports functions that programs can call
  • May have dependencies on other DLLs
  • Contains machine code like executables

DLL Hell (historical problem):

  • Different programs needing different versions of same DLL
  • Version conflicts causing program failures
  • Solved by:
  • Side-by-side assemblies
  • .NET Global Assembly Cache (GAC)
  • Application-specific local DLLs

Examples of common Windows DLLs:

  • kernel32.dll: Core OS functions (memory, processes)
  • user32.dll: User interface elements
  • gdi32.dll: Graphics rendering

Examples of Program Libraries

LibraryPurposeType
C Standard LibraryBasic I/O, string handlingStatic/Dynamic
OpenGL3D graphics renderingDynamic
Python Standard LibraryExtensive modules for PythonDynamic
.NET FrameworkComprehensive Windows developmentDynamic
jQueryJavaScript DOM manipulationDynamic (web)

5.2 Language Translators

Need for Language Translators

Why Translation is Needed

Computers understand machine code (binary). Humans write in:

  • High-level languages (Python, Java, C++)
  • Assembly language

Translation is required to convert human-readable code to machine-executable code.

The Translation Hierarchy

High-Level Language (Python, Java, C++)
             ↓
    [Compiler/Interpreter]
             ↓
Assembly Language (optional intermediate)
             ↓
        [Assembler]
             ↓
     Machine Code (binary)
             ↓
        [CPU executes]

Assembler

Purpose

Translates assembly language programs into machine code.

Input: Assembly language (mnemonics, labels, directives)
Output: Machine code (binary) + symbol table + error messages

How Assemblers Work

One-to-one mapping: Generally one assembly instruction = one machine instruction.

Directives: Instructions to assembler, not CPU (e.g., DATA, ORG, END)

Types of Assemblers

TypeDescription
One-pass assemblerSingle pass through code; requires all labels defined before use
Two-pass assemblerFirst pass builds symbol table; second pass generates code
Macro assemblerSupports macros (reusable code snippets)
Cross-assemblerRuns on one platform, generates code for another

When to Use Assembler

  • When direct hardware control needed
  • For performance-critical code sections
  • In embedded systems with limited resources
  • In operating system development (boot loaders, kernels)
  • For reverse engineering

Compiler

Purpose

Translates entire high-level language program into machine code (or assembly) in one go.

Input: High-level source code
Output: Executable machine code program

Compilation Process

Source Code → Lexical Analysis → Syntax Analysis → 
Semantic Analysis → Intermediate Code Generation → 
Optimisation → Code Generation → Executable

Characteristics

Advantages:

  • Produces standalone executable (no compiler needed to run)
  • Fast execution (already translated)
  • Optimised code possible
  • Source code not required for distribution

Disadvantages:

  • Compilation can be slow (especially large programs)
  • Must recompile entire program after changes
  • Platform-specific (Windows executable won’t run on Linux)
  • Error messages may be less specific

When to Use Compiler

  • For production/release software
  • When performance is critical
  • For large, stable applications
  • When distributing to users without source
  • System software, games, business applications

Examples

  • C, C++ compilers (GCC, Clang, MSVC)
  • Go compiler
  • Rust compiler
  • Pascal compilers

Interpreter

Purpose

Translates and executes high-level language programs line by line.

Input: High-level source code
Output: Results of execution (no standalone executable created)

How Interpretation Works

Source Code
     ↓
[Interpreter reads one line]
     ↓
[Translates to intermediate form]
     ↓
[Executes the line]
     ↓
[Repeats for next line]

Characteristics

Advantages:

  • Easier to debug (stops at error line)
  • No compilation step (faster development)
  • Platform-independent (interpreter handles platform specifics)
  • Interactive programming possible (REPL)

Disadvantages:

  • Slower execution (translation happens each time)
  • Requires interpreter installed to run
  • Source code needed to run
  • May use more memory
  • Errors found at runtime only

When to Use Interpreter

  • During development and testing
  • For scripting and automation
  • For learning programming
  • When rapid prototyping needed
  • For web development (client-side JavaScript)
  • For small utilities

Examples

  • Python (CPython interpreter)
  • JavaScript (in browsers)
  • Ruby
  • PHP
  • Bash shell scripts

Compiler vs Interpreter Comparison

AspectCompilerInterpreter
TranslationEntire program at onceLine by line
Execution speedFast (already translated)Slower (translates each time)
Development cycleEdit → Compile → RunEdit → Run
Memory usageLower at runtimeHigher (interpreter stays in memory)
Error detectionAll errors shown after compilationFirst error stops execution
DebuggingHarder (line numbers may not match)Easier (stops at exact line)
DistributionExecutable file onlyNeed source + interpreter
Platform independenceNo (executable is platform-specific)Yes (if interpreter available)
Code protectionSource hiddenSource visible
OptimisationExtensive possibleLimited

Partially Compiled and Partially Interpreted: Java Example

Java’s Hybrid Approach

Java uses a combination of compilation and interpretation.

Java Source Code (.java)
         ↓
   [Java Compiler (javac)]
         ↓
Java Bytecode (.class files)
         ↓
   [Java Virtual Machine (JVM)]
         ↓
   [Just-In-Time Compiler (JIT)]
         ↓
   Native Machine Code (execution)

How It Works

Stage 1: Compilation

  • Java source compiled to bytecode (platform-neutral intermediate code)
  • Bytecode is NOT machine code
  • Produces .class files

Stage 2: Interpretation/Execution

  • JVM loads bytecode
  • JVM interprets bytecode OR
  • JIT compiler converts frequently used bytecode to native code

Stage 3: JIT Compilation

  • Hot spots (frequently executed code) compiled to native
  • Improves performance over pure interpretation
  • Combines portability with speed

Advantages of This Approach

  • Portability: Bytecode runs on any JVM
  • Performance: Better than pure interpretation
  • Security: JVM can verify bytecode before execution
  • Dynamic optimisation: JIT can optimise based on runtime behaviour

Other Examples

  • C# / .NET: Compiled to CIL (Common Intermediate Language), JIT compiled by CLR
  • Python: Can be compiled to .pyc bytecode for faster loading
  • JavaScript: Modern browsers use JIT compilation

Integrated Development Environment (IDE)

Definition: Software application providing comprehensive facilities to programmers for software development.

IDE Features

1. Coding Features

Context-Sensitive Prompts / IntelliSense / Autocomplete

  • Suggests completions as you type
  • Shows available methods, properties
  • Displays parameter information
  • Reduces typing and errors

Example:

Type "System.Console." → IDE shows WriteLine(), ReadLine(), etc.

Syntax Highlighting

  • Colours different code elements
  • Keywords, strings, comments in different colours
  • Improves readability

Code Templates / Snippets

  • Pre-written code patterns
  • Quick insertion of common structures
  • Example: “for” tab generates for loop skeleton

2. Error Detection Features

Dynamic Syntax Checking

  • Checks code as you type (not just on compile)
  • Underlines errors in real-time
  • Shows error descriptions on hover

Example:

int x = "hello";  ← red squiggly underline (type mismatch)

Compile-time Error Detection

  • Lists all errors in Error List window
  • Double-click error to jump to location
  • Suggests fixes (Quick Actions)

3. Presentation Features

Pretty-Print / Code Formatting

  • Automatically formats code consistently
  • Adjusts indentation, spacing, line breaks
  • Can be customised to coding standards

Example:

Before: if(x>y){max=x;}else{max=y;}
After:  if (x > y)
        {
            max = x;
        }
        else
        {
            max = y;
        }

Expand and Collapse Code Blocks

  • Fold/unfold regions of code
  • Hide method implementations while browsing
  • Show only structure (outline view)

Example regions:

+ public class Customer   [click + to expand]
    - fields
    - constructor
    - methods

4. Debugging Features

Single Stepping

  • Execute one line at a time
  • Step Into: go into function calls
  • Step Over: execute function without stepping through
  • Step Out: complete current function and return

Breakpoints

  • Pause execution at specific lines
  • Conditional breakpoints (pause only when condition true)
  • Temporary breakpoints

Variables Window

  • Watch variables change during execution
  • View local variables, parameters, this
  • Expand objects to see properties

Expression Evaluation

  • Evaluate expressions during debugging
  • Quick Watch feature
  • Immediate window for ad-hoc testing

Call Stack Window

  • Shows chain of function calls
  • Navigate to caller frames
  • See parameters at each level

Report Window / Output Window

  • Shows program output
  • Displays debug messages
  • Compilation results

5. Project Management Features

  • Solution/Project explorer
  • File management
  • References management
  • Build configurations (Debug/Release)
  • Version control integration (Git)

6. Refactoring Tools

  • Rename variables/methods across entire project
  • Extract method from code selection
  • Encapsulate field
  • Find all references

Popular IDEs

IDELanguagesPlatform
Visual StudioC#, VB.NET, C++, PythonWindows
VS CodeMany (extensions)Cross-platform
EclipseJava, C++, PythonCross-platform
IntelliJ IDEAJava, KotlinCross-platform
PyCharmPythonCross-platform
NetBeansJava, PHPCross-platform
XcodeSwift, Objective-CmacOS

Benefits of Using an IDE

  • Increased productivity: All tools in one place
  • Reduced errors: Real-time syntax checking
  • Easier navigation: Jump to definitions, find references
  • Better debugging: Integrated debugger
  • Consistent code: Automatic formatting
  • Learning aid: IntelliSense helps learn APIs
  • Project organisation: Manages complex projects

Summary Checklist for Assessment Objectives

AO1 (Knowledge) – You should be able to:

  • ✓ Explain why OS is needed
  • ✓ Describe OS management tasks (memory, file, security, hardware, process)
  • ✓ List utility software types and purposes
  • ✓ Explain program libraries and DLLs
  • ✓ Define assembler, compiler, interpreter
  • ✓ Describe IDE features

AO2 (Application) – You should be able to:

  • ✓ Match OS management to scenarios
  • ✓ Choose appropriate utility for given task
  • ✓ Justify library use in development
  • ✓ Select appropriate translator for situation
  • ✓ Compare compiler vs interpreter for specific needs
  • ✓ Explain Java’s hybrid approach
  • ✓ Identify which IDE feature to use for specific tasks

AO3 (Design/Evaluation) – You should be able to:

  • ✓ Evaluate OS choices for different systems
  • ✓ Compare utility software options
  • ✓ Assess benefits of library usage
  • ✓ Judge when to use compiler vs interpreter
  • ✓ Evaluate IDE effectiveness for development
  • ✓ Design development environment setups

Scroll to Top