Return to main page
View source or report issues on GitHub

Programs and Software

In the previous lesson, we learned a bit about how a computer processor uses the Machine Instruction Cycle to execute a series of instructions. We call a connected group of CPU instructions a computer program or piece of software:star:.

Programming Languages and Compilers

It is interesting to think about HOW a piece of software is written. We touched on this in our initial page of notes, but lets look in a little more detail.

High Level Programming Languages

Most computer software is written by humans, using a high-level programming language:star: - like Java! - that lets the human write software in a way that makes sense to them.4.3.4 High level programming languages can look very different from each other, but they all have a few key features in common.4.3.3, including:

The goal of these features is to make sure that every computer program has an unambiguous meaning - it is really important there can only be one possible interpretation of a computer program, because computers aren’t smart!

Compilers and Interpreters

Compiler Process
Image credit: GeeksForGeeks

When a human writes a computer program in a high-level language, they have made something thats easy for HUMANS to read, but it is not written for computer processors. Before the software can be run, it needs to be translated into a series of instructions (fundamental operations!) that the processor can actually be understand.

A compiler:star:4.3.5 is a special piece of software that takes code written in a high-level language and converts it to the machine code that the computer can read, with the goal of making the machine code as efficient as possible. A compiler will go through five important steps.4.3.5

  1. It pre-processes the program, which allows it to replace some elements with more efficient (but less readable) code. For example, if you have a constant in your code like final int PI=3.14, the pre-processing step will replace the word PI with the actual value 3.14 everywhere in the code.

  2. It performs lexical analysis to convert the characters in the actual programs to special internal tokens that have meaning to the processor.

  3. It parses the symbols created in lexical analysis step and builds an internal structure showing how the symbols are related to each other, which helps the compiler understand the structure of the program.

  4. It optimizes the code by finding places in the parsed program that can be sped up or made to take up less memory.

  5. Finally, it translates the parsed and optimized code into machine instructions.

Some programming languages, such as Java and C, have separate compilers that translate source code into object code, which can then be distributed separately. Other programming languages, like javascript and python, can use an interpreter, which is essentially a compiler that runs on the fly and creates object code from source code as the program runs. Advantages of compiled languages include being more efficient and faster to run and being able to distribute software without the source code, while advantages of interpreted langugages include speed of writing code, flexibility, and ease of distribution.

The Operating System (OS)

One of the most important pieces of software run on any computer is the operating system:star:2.1.6. The operating system provides an environment for all of the user-facing application software on a computer to run inside, and manages all of the important resources in a computer.

Commonly used operating systems you might have encountered include Mac OS X, Microsoft Windows, iOS, WatchOS (apple), Android, Android Wear, ChromeOS, FitbitOS, Tizen, Unix, Linux, Alexa, Google Assistant, and so on.

Key Roles of an OS

User Interface Examples
Image Credit: IB Compsci Hub

Application Software

Most of the software that a user interacts with on a traditional computer can is called application software:star: - these are the “Apps” or “Programs” you install on your computer or phone and run or switch between.2.1.7 Some common types of application software include:

Word Processor Image

Spreadsheet image

All of these types of software, as well as other software you might install, should include some common features such as windows, toolbars, menus, and so on, as defined by the OS and implemented by the application software itself.2.1.8

Check Your Understanding

  1. One of the things a compiler does is translate source code to byte code. Name two other things done by a compiler. (IB )

  2. Identify two types of general application software that might be installed on office computers. (IB SL May 2019 #15c)

    Show official IB markscheme

    Examples might include: web browser; word processor software; spreadsheet software; database management software; e-mail client

    Award 1 mark for each reasonable category, up to [2] marks. Award NO marks for specific software title (e.g. Microsoft Word or Google Chrome)

  3. Outline the role of the operating system in managing primary memory (IB SL Nov 2018 #8aii)

    Show official IB markscheme

    Award [1] for the answer saying that the function of OS in primary memory management is allocation of specific memory blocks to individual programs and [1] for reallocation up to [2 max].

    Example answer:
    A part of the OS (memory manager) assigns that block of memory to the program when a running program requests a block of memory; When the program no longer needs the data in previously allocated memory blocks, they become available for reassignment;