This is an old revision of the document!
Table of Contents
Computer Science
Computer science is the study of algorithm
Basics of Computers
Computer Organization
Components
Modern computers are built using Von Neumann machine architecture.
Von Neumann machine have 3 aspects:
- Architecture: I/O + Memory + CPU (CU: Control Unit + ALU: Arithmetic & Logic Unit)
- Those components are connected to the BUS
- Stored Programs: All programs and data are in stored as binary information in the memory
- Sequential Execution: The CPU will do 1 thing at a time. In 1 cycle the CPU will do one and one thing only.
- This is also known as Fetch Decode Execute
- Memory (is binary information) → fetched → CU → Decoded → ALU → Execute (the task).
- Decode and Execute are done by the same computer chip: the CPU
Memory
Computer memory is organized as a hierarchy. At the bottom, there is the hard drive. At the top level there is the CPU.
Because hard drives are slow, when a software is loaded, the software gets loaded in the Random Access Memory (RAM).
The RAM is still not fast enough for the CPU, so the instructions are actually executed in the Cache memory. HD: Probably TB in size RAM: Probably GB in size Cache: Probably KB in size
The memory is organized as an array or a table. Each row is 1 byte. 1 byte is 1 bit. 1 byte = 1 word
Address | 1 byte = 8 bits | |||||||
---|---|---|---|---|---|---|---|---|
0 (0000 0000) | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit |
1 (0000 0001) | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit |
2 (0000 0002) | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit | 1 bit |
1111 1111 | … | … | … | … | … | … | … | … |
Algorithm
Design
- Step 1: Do something
- Step 2: Do something
- Step 3: Do something
- … : …
Sequential steps
A sequential step is a single task; for example a 1 to x
.
Conditional steps
Ask a question that is answered with a logic answer. The answer can be true
/false
.
For example:
if (x > 0) add 1 to x else substract 1 from x
Loops
Iterative steps.
add 1/2 cup to mixture while mixture is dry