A computer has two types of memories: main memory and secondary memory (disks, USB drives, CDs). Main memory is fast, small, and volatile. Secondary memory is slow, large, and static.
When a program starts it copies instructions and data from secondary memory to main memory. When a program ends its data and instructions are flushed out of main memory.
Secondary memory is organized as a hierarchy or tree of directories and files.
Main memory is an array of cells. Each cell contains a byte and has a unique address. We can read or write to a cell.
Memory capacity is measured in Kb, Mb, even Gb.
A byte consists of 8 bits.
A bit is 0 or 1
Bytes and addresses are usually represented in hexadecimal notation.
A hex digit (0 – F) represents 4 bits (why?)
0x0000: 0x00
0x0001: 0x00
0x0002: 0x00
0x0003: 0x00
0x0004: 0x00
0x0005: 0x00
0x0006: 0x00
0x0007: 0x00
0x0008: 0x00
0x0009: 0x00
0x000A: 0x00
0x000B: 0x00
0x000C: 0x00
0x000D: 0x00
0x000E: 0x00
0x000F: 0x00
0x0010: 0x00
0x0011: 0x00
0x0012: 0x00
0x00013: 0x00
0x00014: 0x00
etc.
The instruction set of a processor is the set of instructions that the processor knows how to execute. The instruction set can be viewed as a primitive programming language called a machine language.
A machine language instruction is very simple. It typically combines the data in two memory locations using an arithmetic (+, -, *, /, %) or logic operator (&&, ||, !), and writes the result back to main memory.
For example, the following instruction adds 1 to the byte stored in main memory at address 0x000A and stores the result in 0x000C:
add [0x000A] 0x01 [0x000C]
Naturally, machine language instructions are represented as bits in the computer's memory.
A processor is a chip that perpetually runs the fetch-execute cycle:
1. Fetch the next instruction from main memory
2. Fetch the data needed by this instruction from main memory
3. Execute the instruction
4. Write the result back to main memory
5. Goto 1
A peripheral device that connects to a computer (flash drive, network, disk, printer, monitor, keyboard, etc.) is controlled internally by a special chip or card called a controller.
Controllers, memory, and processor exchange data through the system bus.
The File System
Shells
Running programs
Multi-Tasking
Windows
Users
Utilities and drivers
Examples: MS Windows, UNIX
Definition: An algorithm is a well defined procedure for solving a problem or accomplishing a task. Algorithm is an informal concept.
A program is a representation of an algorithm in a particular programming language. A general purpose language can, in theory, represent any algorithm, but this is impossible to prove since algorithm is an informal concept.
Although general purpose and efficient, machine languages lack expressiveness and are processor-dependent. By contrast, high-level languages are expressive and processor-independent.
Examples of high-level languages:
FORTRAN, LISP, BASIC
Pascal,
C++, Java
The programming level consists of one or more high level language processors.
There are two types of language processors: interpreters and compilers.
Interpreters are also called virtual machines. They are like processors, only they are implemented in software rather than hardware and their instruction set is a high level language.
A compiler translates a program written in a high level language into an equivalent machine language program.
Java has both types of processors. It has a compiler that translates files containing Java programs into files containing a virtual machine language called Java Byte Code. It also has an interpreter or virtual machine that executes files containing Java Byte Code.
Demo
Games
Tools: Office tools, Development tools, Browsers