7 System Software



  • Overview of this Chapter

    Classification of Software.

    7.1 Operating Systems

    7.2 Utility Programs

    7.3 Library Programs

    7.4 Language Translators

    • 7.4.1 Assemblers

    • 7.4.2 Compilers and Interpreters


    7.1 Operating Systems

    Operating Systems: A software platform that provides facilities for programs to be run.

    The functions of Operating Systems includes:

    1. Provides Interface
      • User-System Interface
      • Program-Hardware Interface
    2. Resource Management
      • Memory Management
      • Device Management
      • File Management
      • Security Management
    3. Error Detection and Recovery

    7.1.1 OS Interface

    User-System Interface

    There are two types of interface:

    • GUI (Graphic-user Interface) consists of "WIMP":

      • W: Windows

      • I: Icons

      • M: Menus

      • P: Pointers

    • CLI (Command-line Interface) is text-based like programing languages.

    Program-Hardware Interface

    Programmers and users can write programs without needing to know details of the hardware.

    The OS finishes that part -- letting hardware do what software wants it to do.

    OS acts more like a "bridge".


    7.1.2 Resource Management

    Consists of five parts:

    1. Process Management
    2. Memory Management
    3. File Management
    4. Security Management
    5. Error Detection and Recovery

    a) Process Management

    A program that has begun execution is known as a "Process". There are multiple processes running at the same time. OS needs to allocate resources for them.

    On general functions include:

    • Scheduling of processes.
    • Resolution of conflicts.

    b) Memory Management

    Functions include:

    • Memory Protection. Prevents more than one program using same memory location.
    • Memory Organization. Optimize usage of limited memory space, e.g. Virtual Memory assigned on secondary storages, when RAM is not enough.
    • Usage Optimization. Decides which process can use main memory and where they are stored.

    c) Security Management

    Functions include:

    • File Renaming
    • Directory / Folder structures

    d) Security Management

    Functions include:

    • Protect
      • Prevents intrusion by denying unauthorized access
    • Recovery
      • Recovers data after a breach.

    e) Error Detection and Recovery

    When a process somehow had a fatal error (e.g. Hardware, Syntax, Index...):

    1. The OS can detect the crashed process.
    2. The OS will interrupt the process.
    3. A diagnosis of the cause will be provided.
    4. In the case of a serious error, the OS needs to reboot the whole computer. Files will be saved to prevent data loss.

    An example of a badly-written code causing a crash.
    The Mac OS system interrupts the process and gives out an error report. @Raymond-wu


    7.2 Utility Programes

    1. Hard disk formatter (and checker)
    2. Hard disk defragmenter
    3. Backup software
    4. File compression
    5. Virus checker

    7.2.1 Hard Disk Formatter

    Formatting

    When formatting a hard drive, the followings will happen:

    1. All existing data will be removed.
    2. The file system will be set up.
      • The file system is a table recording where files are stored in the hard disk.
    3. (As required) The hard disk is partitioned into local drives.

    Formatting a drive.

    Error checking

    Possible reasons to generate disk errors:

    1. Bad sectors.
      • e.g. Moving the hard disk while the disk heads are not secured.
      • It hits the disk and cause permanent physical damage.
    2. Interrupt during file operation.
      • e.g. Abnormal system shutdown.
      • Files are only partially written into the disk.

    Process of error checking:

    1. The disk repairer scans the hard disk.
    2. It marks out the bad sectors found. The system will not use those sectors.
    3. The system will try to recover the damaged files. If it can't be recovered, then it's deleted.

    7.2.2 Hard Disk Defragmenter

    During the use of hard disks, files might be stored in discontinued different sectors.

    The defragmenter reorganizes the files to a state when all files are stored in contiguous sectors.

    File defragmentation


    7.2.3 Backup software

    Same as manual backup of copying files to another hard drive.

    It has 2 additional features:

    1. A schedule is established for regular backup.
    2. Only produce a backup when there is a change.

    7.2.4 File Compression

    Reduce file size to:

    a) Reduce storage space

    b) Faster transmitting speed

    See more in Chapter 1.


    7.2.5 Virus Checker

    The virus checker checks for viruses two occasions:

    1. When a file enters the computer system.
    2. When scanning the disks.
      • Some viruses may bypass <step1> while it was just released, still unknown by virus checkers.

    7.3 Library Programs

    Mostly built-in subroutines in the operating system.

    Reasons we need library programs

    a) There's no advantage in reinventing the wheel. Existing programs are reliable and efficient enough.

    b) A linker is required. Different machines execute a function differently. The 'actual' function (which varies by machine) is inserted only at the final linking stage. This enables one source code to be used in multiple machines.

    Alternative: Dynamic Linking (DLL)

    In this method linking happens when the code is running. When code is running it links to DLL routine it requires.


    7.4 Language Translators

    "Which translator should I use?"

    • Low Level → Machine
      • 7.5.1 Assembler
    • High Level → Machine
      • 7.5.2 Compiler
      • 7.5.3 Interpreter

    FAQs:

    1. "Why do we need translators?" -> Chapter 6.
    2. "Can you explain more?" -> Chapter 20 (A2-Level)

    7.4.1 Assemblers

    Translates assembly language to object code.

    Most commonly a two-pass assembler is used. It means that there are two stages in the assemble.

    First Pass Second Pass
    Comments are removed. Replace symbolic address (identifiers) to absolute address (real address in memory).
    Tables are created. <br/>- A symbol table, containing binary codes for symbolic names and labels (e.g. variable 'name' represented to 111) <br/>- A Literal table, containing all the constants used. Generates object code.
    Macros (similar to subroutines, a series of commands) are expended. <br/> An object code has to pass through a linker to generate the executable code.
    Identification of system calls and subroutine used.
    If no errors are found then it moves on to the second pass.

    7.4.2 Compilers and Interpreters

    How interpreters work

    How Compilers Work

    Comparison in a nutshell

    Interpreter Compiler
    Requires translator to execute? Yes No<br />But still needs linker.
    Reports Error Stop executing when discovered and report Only records the error when discovered <br/>Report only at the end

    Advantages of each translator

    Interpreter Compiler
    Errors Errors identified immediately, without the need to wait whole program to compile. There will be no omissions of syntax errors.<br />(Since the whole program is examined every time. Interpreter only translates what it needs)
    Source code Source code not published to user.
    Execution More secure. Compiled program might contain a virus. Only the object code is required. No need for a translator to be present.
    Faster execution.

    Java

    Java consists of both a compiler and interpreter.

    The Java Virtual Machine acts as an interpreter to execute the Java Byte Come.


Log in to reply