NSSCAS Computer Science (8231) study materials
NSSCAS Computer Science (8231) study resources

NSSCAS Computer Science (8231): System software

NSSCAS Computer Science (8231) · Work through your exam, one topic at a time.

All guide sections

System software

System software covers what sits between the hardware and the user: operating system functions, interrupt handling, scheduling, memory management, and the translators and tools that turn source code into a running program.

Operating system functions

The OS provides a user interface, manages processor scheduling (round robin, first come first served, shortest job first, priority), allocates memory (paging, segmentation, virtual memory), organises files and directories, controls I/O through device drivers, and enforces security through accounts and permissions. An interrupt is a signal that causes the CPU to suspend the current process, save its state and run an interrupt service routine; interrupts have priorities.

Translators

A compiler translates the whole program into object code before execution. It reports errors at the end, produces an executable that runs without the compiler, and can optimise code - but the executable is platform-specific. An interpreter translates and executes one statement at a time: easier for beginners and debugging, but slower at run time and dependent on the interpreter being present. An assembler translates assembly mnemonics into machine code, usually one instruction for one instruction.

Stages of compilation

Lexical analysis converts characters into tokens and builds the symbol table. Syntax analysis checks the tokens against the grammar and builds a parse tree, reporting syntax errors. Semantic analysis checks meaning: undeclared identifiers, type mismatches, wrong parameter counts. Code generation produces intermediate or object code, then optimisation improves it.

Worked example

For total = total + 1 where total was never declared, lexical analysis succeeds, syntax analysis builds a valid tree, and semantic analysis fails with an undeclared identifier. For total = total +, syntax analysis fails first. Naming the stage earns the mark; saying 'it is a bug' does not.

Linkers combine object modules and library routines and resolve external references; loaders place the executable in memory. Static libraries are copied into the executable, while dynamic libraries are loaded at run time and shared.

Traps

Saying a compiler finds all errors (it cannot find run-time errors); confusing linker and loader; claiming an interpreter produces a standalone executable; attributing a type error to syntax analysis.