Cambridge AS & A Level9608

System software (1.5)

Computer Science 9608 Chapter Notes

What this chapter covers

System software
ShareWhatsAppPost
System software (1.5) notes

Unable to load PDF

The notes viewer could not load. Please refresh the page.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full System software (1.5) notes as text: skim, search, and jump between subtopics.

~17 min read

1. The Role of the Operating System

An operating system (OS) is the most important piece of system software on a computer. It acts as an intermediary between the user and the computer's hardware. Without an OS, you would have to manually control every aspect of the hardware, which is incredibly complex. The OS manages all hardware and software resources, providing a stable and consistent environment for applications to run. Its main functions include providing a user interface, managing memory, managing the processor (CPU), handling input and output devices, managing files on storage drives, and ensuring system security.

Key term

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

Examiner insight

Examiners expect students to name and then explain several distinct management tasks performed by the OS, not just list them. A good explanation will describe *why* the task is necessary.

Common pitfall

Confusing the operating system with application software. The OS manages the system (e.g., Windows, macOS), while applications perform user tasks (e.g., a web browser, a game).

Fun fact

The Linux kernel, the core of the Linux OS, was first released in 1991 by Linus Torvalds and originally contained only about 10,000 lines of code. Today, it has over 27 million lines.

Worked example 14 marks

One of the reasons for having an operating system is to provide a user interface. Name two different types of interface an OS can provide and give an example of a suitable input device for each.

  1. 1
    1. Graphical User Interface (GUI): This interface uses windows, icons, menus, and pointers (WIMP) to allow users to interact with the system visually.
  2. 2

    Input device for GUI: A mouse is used to point at and click on icons and menus.

  3. 3
    1. Command Line Interface (CLI): This interface requires the user to type in text-based commands to perform tasks.
  4. 4

    Input device for CLI: A keyboard is used to type the commands.

Worked example 26 marks

Identify and explain briefly three management tasks carried out by an operating system.

  1. 1
    1. Memory Management: The OS is responsible for allocating and deallocating portions of the main memory (RAM) to programs and data. It ensures that one process does not interfere with the memory space of another.
  2. 2
    1. Processor (CPU) Management: In a multitasking system, the OS decides which process gets to use the CPU and for how long. This is managed by a scheduler to ensure the CPU is used efficiently and all processes get a fair amount of processing time.
  3. 3
    1. File Management: The OS provides a logical file system for storing, retrieving, organising, and deleting files on secondary storage devices like hard drives. It manages file permissions and keeps track of where files are located.

Recap

  • An operating system is essential software that manages all computer hardware and software.
  • It provides a user interface (like a GUI or CLI) to hide hardware complexity from the user.
  • Key OS tasks include memory management, processor management, and file management.
  • The OS handles all communication with peripheral devices such as printers and keyboards.
  • It is responsible for system security, such as user authentication and access rights.

Quick check

  1. What is the general term for the OS function that involves allocating CPU time to different running programs?1 mark
  2. State the two main types of user interface.2 marks

2. Processor and Memory Management

Two of the most critical OS tasks are managing the processor and memory. A program that has started executing is called a 'process'. The OS uses a 'scheduler' to manage which process gets to use the CPU at any given moment, allowing for 'multitasking' where multiple processes appear to run at once. This is achieved by giving each process a small time slice of the CPU before switching to another, often triggered by an 'interrupt'—a signal from hardware or software requiring attention. For memory management, the OS allocates RAM. When physical RAM is insufficient, it uses 'virtual memory'. This technique uses a portion of the hard drive as if it were RAM. Memory is divided into fixed-size blocks called 'pages'. Inactive pages are temporarily moved from RAM to the hard drive ('swapped out') and brought back when needed ('swapped in').

Key term

Virtual Memory: A memory management technique where secondary storage is used as if it were part of the main memory (RAM).

Examiner insight

For virtual memory questions, clearly linking the use of secondary storage (like a hard disk) to the concept of extending RAM is crucial for full marks. Mentioning 'paging' or 'swapping' strengthens the answer.

Common pitfall

Confusing multitasking (multiple processes sharing one CPU by rapidly switching) with multiprocessing (a system having multiple CPUs to execute processes truly simultaneously).

Fun fact

The concept of virtual memory was first developed in the late 1950s at the University of Manchester for the Atlas Computer, one of the world's first supercomputers.

Worked example 14 marks

Explain how an operating system uses paging to implement virtual memory.

  1. 1
    1. The OS divides both physical memory (RAM) and a program's logical address space into fixed-size blocks called pages.
  2. 2
    1. When a program is run, not all of its pages need to be loaded into RAM at once. Only the necessary pages are loaded.
  3. 3
    1. If the RAM becomes full and a new page needs to be loaded, the OS selects an inactive page currently in RAM and writes it to a swap file on the hard disk (secondary storage).
  4. 4
    1. The new page can then be loaded into the now-free space in RAM.
  5. 5
    1. This process of swapping pages between RAM and the hard disk creates 'virtual memory', allowing the system to run larger programs or more programs than it has physical RAM to support.

Worked example 24 marks

A user notices their computer is running very slowly, and the hard drive light is constantly flashing. Explain what 'disk thrashing' is and why it causes this problem.

  1. 1
    1. The problem described is likely 'disk thrashing'.
  2. 2
    1. This occurs in a virtual memory system when there is not enough physical RAM to hold all the active pages for the currently running processes.
  3. 3
    1. As a result, the OS spends an excessive amount of time swapping pages back and forth between RAM and the hard disk.
  4. 4
    1. A page is swapped in for a process, but another page must be swapped out. Almost immediately, the system needs the page it just swapped out, causing another swap.
  5. 5
    1. This constant swapping ('thrashing') means the CPU spends more time waiting for pages to be retrieved from the slow hard disk than it does executing program instructions, severely degrading system performance.

Recap

  • A program in execution is called a process.
  • The OS scheduler manages which process uses the CPU, enabling multitasking.
  • Interrupts are signals that cause the CPU to pause its current task to attend to a higher-priority event.
  • Paging involves dividing memory into fixed-size blocks to manage memory allocation.
  • Virtual memory uses secondary storage to extend RAM, but can lead to disk thrashing if overused.

Quick check

  1. What is the name of the OS component that decides which process to run next?1 mark
  2. What is the name for the problem caused by excessive swapping of pages in a virtual memory system?1 mark

3. Utility Programs and Program Libraries

Besides the OS itself, system software includes other useful programs. 'Utility programs' are small applications designed to help manage, maintain, and optimise the computer system. They perform specific housekeeping tasks. Examples include disk defragmenters (reorganising files for faster access), file compression tools (reducing file sizes), backup utilities, and antivirus software. Separately, when programmers write software, they don't always start from scratch. They often use 'program libraries', which are collections of pre-written, pre-tested code (functions, subroutines) that can be easily included in a new program. This saves time, reduces errors, and allows developers to use expert-written code for complex tasks. A common example is a 'Dynamic Link Library' (DLL), a library that is loaded into memory only when a program needs it, saving RAM.

Key term

Utility Program: System software designed to perform a specific task to help manage, maintain, or control computer resources.

Examiner insight

When asked for examples of utility programs, students should name a specific utility and then clearly explain both what it does and why it is needed.

Common pitfall

Confusing utility programs with the operating system itself. Utilities are separate programs that work alongside the OS, and are often bundled with it, but are not part of the core OS kernel.

Fun fact

The .zip file format, a common form of file compression, was created in 1989. The 'zip' name was suggested by a friend of the creator, implying speed.

Worked example 14 marks

Identify two utility programs that might be used to manage a hard disk, and for each, explain what it does.

  1. 1
    1. Utility: Disk Defragmenter. Explanation: Over time, as files are saved, deleted, and modified, parts of a single file can become scattered across different physical locations on the disk ('fragmented'). A defragmenter reorganises the disk by placing all parts of each file in contiguous blocks. This reduces the time it takes for the read/write heads to access a file, improving performance.
  2. 2
    1. Utility: Disk Formatter. Explanation: Formatting prepares a disk for use by the operating system. It erases all existing data and creates a new file system structure (like a blank index for a book), allowing the OS to store and retrieve files on that disk.

Worked example 24 marks

Explain two benefits to a software developer of using program libraries.

  1. 1
    1. Saves Time and Effort: The developer does not need to write code for common tasks (e.g., mathematical calculations, graphics rendering) from scratch. They can simply call the function from the library, which significantly speeds up the development process.
  2. 2
    1. Increased Reliability: Library code is typically written by experts and has been thoroughly tested and debugged across many applications. Using this proven code makes the final program more robust and less likely to contain errors compared to writing everything new.

Recap

  • Utility programs perform specific tasks to maintain or optimise the computer system.
  • Examples of utilities include disk defragmenter, file compression, and backup software.
  • Program libraries are collections of pre-written code that developers can use.
  • Using libraries saves development time and increases the reliability of the final software.
  • Dynamic Link Libraries (DLLs) are linked at run-time, which can save memory.

Quick check

  1. What is the purpose of file compression utility software?1 mark
  2. State one reason why a programmer would use a program library.1 mark

4. Language Translators: Compilers vs. Interpreters

Computers only understand machine code, which is a sequence of binary digits. Humans write programs in high-level languages (like Python or Java) that are easier to understand. A 'language translator' is a program that converts high-level source code into machine code. There are two main types: compilers and interpreters. A 'compiler' reads the entire source code and translates it all at once into a standalone executable file. This file can then be run without the compiler. It reports all syntax errors at the end of the compilation process. An 'interpreter', on the other hand, reads the source code and translates and executes it one line at a time. It stops as soon as it finds an error. No executable file is created, and the source code and interpreter are needed every time the program is run.

Key term

Compiler: A program that translates the entire source code of a high-level language into machine code, creating a separate executable file.

Examiner insight

Clear comparisons are key. A good answer will contrast compilers and interpreters on at least three distinct points: the translation process (all at once vs. line-by-line), the output (executable vs. none), and error handling.

Common pitfall

Mixing up the characteristics. A common mistake is saying a compiler translates line-by-line, or that an interpreter produces an executable file.

Fun fact

The first compiler was created by Grace Hopper in 1952 for the A-0 programming language. Her work was initially met with skepticism, as many believed programming was an art that couldn't be automated.

Worked example 13 marks

State three differences between how an interpreter works and how a compiler works.

  1. 1
    1. Translation Process: A compiler translates the entire program into machine code before the program is run. An interpreter translates the program one statement at a time, during execution.
  2. 2
    1. Output: A compiler produces a standalone executable file of machine code. An interpreter does not produce an executable file; the source code is required for every execution.
  3. 3
    1. Error Reporting: A compiler scans the whole program and reports a list of all syntax errors at the end. An interpreter stops execution as soon as the first error is found.

Worked example 24 marks

Discuss one advantage and one disadvantage of using an interpreter compared to a compiler during program development.

  1. 1
    1. Advantage of Interpreter: Debugging is easier. Because the interpreter stops at the exact line where an error occurs, it is simpler for the programmer to pinpoint and fix the fault. They can immediately see the state of the program at the point of failure.
  2. 2
    1. Disadvantage of Interpreter: Execution is slower. The program has to be translated every time it is run, and the line-by-line translation process adds significant overhead compared to running a pre-compiled executable file. This makes interpreters unsuitable for performance-critical applications.

Recap

  • Language translators convert high-level source code into low-level machine code.
  • A compiler translates the entire program at once, creating a fast executable file.
  • An interpreter translates and runs the program line by line, which is slower but good for debugging.
  • Compilers report all errors at once; interpreters stop at the first error.
  • Compiled programs run independently, while interpreted programs need the interpreter and source code to run.

Quick check

  1. Which translator produces an executable file?1 mark
  2. Which translator is generally faster at running a finished program?1 mark

5. Language Translators: The Assembly Process

Assembly language is a low-level programming language that is one step above machine code. It uses short, English-like mnemonics (e.g., LDA for 'load accumulator', ADD for 'add') to represent machine code instructions, making it more readable for humans. The system software that translates assembly language into machine code is called an 'assembler'. Most assemblers use a 'two-pass' approach to handle 'forward references'—when a label (like a variable or jump target) is used in the code before it has been defined. The process is: 1. First Pass: The assembler reads the source code to build a 'symbol table'. This table maps all the labels in the code to specific memory addresses. No machine code is generated yet. 2. Second Pass: The assembler reads the source code again. This time, it translates the instruction mnemonics into machine code opcodes and uses the completed symbol table to substitute the memory addresses for all the labels. This produces the final object code file.

Key term

Assembler: A program that translates assembly language into machine code.

Examiner insight

For questions on the two-pass assembler, be specific about what happens in each pass. For the first pass, 'building the symbol table' is the key phrase that examiners look for.

Common pitfall

Simply stating the assembler 'translates the code' in both passes. The key is to differentiate the *purpose* of each pass: the first is for symbol table creation, the second is for actual code generation.

Worked example 13 marks

Explain why a two-pass assembler is often necessary.

  1. 1
    1. A two-pass assembler is necessary to handle 'forward references'.
  2. 2
    1. A forward reference occurs when an instruction refers to a label that appears later in the code. For example, a jump instruction 'JMP LoopStart' might appear before the 'LoopStart:' label is defined.
  3. 3
    1. In a single pass, the assembler would not know the memory address of 'LoopStart' when it first encounters the JMP instruction.
  4. 4
    1. By using two passes, the first pass can scan the entire code to build a symbol table containing all labels and their corresponding addresses. The second pass can then use this complete table to correctly translate all instructions, including the forward references.

Worked example 24 marks

Describe the main output of the first pass and the main output of the second pass of a two-pass assembler.

  1. 1
    1. Output of First Pass: The main output is a completed symbol table. This table contains every label defined in the assembly program and its calculated memory address. Some basic syntax checking may also occur.
  2. 2
    1. Output of Second Pass: The main output is the final object code, which is the machine code translation of the original assembly program. This is created by translating instructions and replacing symbolic addresses (labels) with the actual addresses from the symbol table.

Recap

  • Assembly language uses mnemonics to represent machine code instructions.
  • An assembler is the translator for assembly language.
  • A two-pass assembler is used to resolve forward references.
  • The first pass builds a symbol table, mapping labels to addresses.
  • The second pass uses the symbol table to generate the final machine code.

Quick check

  1. What is the primary data structure created during the first pass of an assembler?1 mark
  2. What is the term for an instruction referring to a label that has not yet been defined in the code?1 mark

6. Stages of Compilation and Hybrid Languages

The compilation process is not a single step; it's a pipeline of stages. The main stages are: 1. Lexical Analysis: The source code is scanned, and comments and whitespace are removed. The code is broken down into a stream of 'tokens' (the smallest meaningful units, like keywords, identifiers, and operators). 2. Syntax Analysis (Parsing): The stream of tokens is checked against the grammar rules of the programming language to ensure it forms valid statements. This is often done by building a 'parse tree'. If the code violates the grammar, a syntax error is reported. 3. Code Generation: A correct parse tree is used to generate machine code (or an intermediate code). 4. Code Optimisation: This optional but important stage analyses the generated code and attempts to make it more efficient—either faster to execute or smaller in size—without changing its functionality. Some languages, like Java, use a hybrid approach. The Java compiler translates source code not into machine code, but into an intermediate form called 'bytecode'. This bytecode is then executed by a 'Java Virtual Machine' (JVM), which interprets the bytecode for the specific hardware it's running on. This makes Java platform-independent.

Key term

Lexical Analysis: The first phase of compilation, where the source code is scanned and broken down into a series of tokens.

Examiner insight

Students should be able to name the stages of compilation in order and give a brief, one-sentence description of what each stage does. For Java, mentioning both 'bytecode' and 'JVM' is essential.

Common pitfall

Confusing syntax analysis with lexical analysis. Lexical analysis deals with creating valid tokens (the 'words'), while syntax analysis deals with arranging those tokens into valid statements (the 'sentence structure').

Fun fact

Backus-Naur Form (BNF), a formal notation used to describe language syntax for the syntax analysis stage, was developed in the late 1950s to describe the ALGOL 60 programming language and is still widely used today.

Worked example 14 marks

Describe the purpose of lexical analysis and syntax analysis during the compilation of a high-level language program.

  1. 1
    1. Lexical Analysis: This is the first stage. It reads the source code as a sequence of characters. It removes unnecessary elements like comments and whitespace. It then groups the characters into meaningful 'tokens', such as keywords (e.g., 'WHILE'), identifiers (e.g., 'score'), and operators (e.g., '>='). Information about identifiers is stored in a symbol table.
  2. 2
    1. Syntax Analysis (Parsing): This stage takes the stream of tokens from the lexical analyser. It checks if the sequence of tokens follows the grammatical rules (syntax) of the programming language. It does this by attempting to build a parse tree. If the tokens form a valid structure according to the language's rules, compilation continues; otherwise, a syntax error is generated.

Worked example 24 marks

Java is often described as 'platform-independent'. Explain how its use of a compiler and a virtual machine achieves this.

  1. 1
    1. Java source code is first compiled into an intermediate code called bytecode, not native machine code for a specific CPU.
  2. 2
    1. This bytecode is platform-independent; the same bytecode file can be used on any computer.
  3. 3
    1. To run the program, a computer needs a Java Virtual Machine (JVM). The JVM is a piece of software that is specific to the operating system and hardware (e.g., there is a JVM for Windows, one for macOS, etc.).
  4. 4
    1. The JVM interprets the universal bytecode, translating it into the native machine code that the local computer can understand and execute. This 'write once, run anywhere' approach makes Java platform-independent.

Recap

  • Compilation involves several stages: lexical analysis, syntax analysis, code generation, and optimisation.
  • Lexical analysis converts source code into a stream of tokens.
  • Syntax analysis checks if the tokens obey the language's grammar rules.
  • Code optimisation aims to make the final machine code faster or smaller.
  • Java uses a hybrid approach, compiling to bytecode which is then interpreted by a Java Virtual Machine (JVM).

Quick check

  1. Which stage of compilation checks for grammatical errors in the code?1 mark
  2. What is the name of the intermediate code produced by a Java compiler?1 mark

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. Define the term 'operating system' and state two of its key functions.3 marks
  2. Explain the difference between a compiler and an interpreter, mentioning the output and error handling of each.4 marks
  3. Describe the purpose of the first pass and the second pass of a two-pass assembler.4 marks
  4. Explain the concept of virtual memory, including the role of paging and secondary storage.4 marks
  5. A programmer is developing a large, complex video game where execution speed is critical. Justify whether they should use a compiler or an interpreter for the final release of the game.3 marks
  6. Describe the roles of lexical analysis and code optimisation in the compilation process.4 marks
  7. Explain how an operating system uses interrupts and a scheduler to manage multitasking on a computer with a single-core processor.5 marks
  8. Explain what a Dynamic Link Library (DLL) is and give one benefit and one drawback of using it.3 marks
  9. A computer system is suffering from disk thrashing. Explain what this means and suggest a hardware-based solution to the problem.4 marks
  10. Name and describe two different types of utility program that are not used for disk management.4 marks

Go deeper

Practise and revise with member-only material for this chapter.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters