Programming
and Databases

Joern Ploennigs

Computer hardware

Midjourney: Man Computer, ref. Fritz Kahn

Process¶

Definition: Computer¶

Computers are ubiquitous nowadays and perform many tasks in our daily lives. They are formally defined as

📘 Definition: Computer

A computer is a device that processes data using programmable calculation rules.

Lecture Hall Question¶

What types of computers are there?

No description has been provided for this image
Midjourney: A Mona Lisa-style painting with a goat taking a photo with an iPad

Types of Computers¶

  • Supercomputer – Special-purpose computers with very many CPUs and GPUs for highly parallel processing of complex problems (e.g., weather simulations)
  • Mainframe – Special-purpose large machines with very high reliability, e.g., in banks
  • Server – Computers in data centers without a display for the Internet or cloud computing
  • Personal Computer (PC) – Desktop computers in offices or at home for work, gaming, etc.
  • Laptops – Mobile computers on the go for work, gaming, studying
  • Smartphones – Mobile devices with a touchscreen and limited phone functionality
  • Tablets – Mobile computers with large touchscreens and no phone functionality
  • Embedded Computers – Small computers in cars, robots, and smart homes

Lecture Hall Question¶

What hardware makes up a computer?

No description has been provided for this image
DALL-E 2: Early designs of the iPhone by Leonardo da Vinci

PC Build¶

Image

The core components of a computer are:

  • the CPU as the central processing unit,
  • the GPU for graphical applications,
  • the RAM as the main memory, and
  • a hard drive (HDD) or solid-state drive (SSD)

Computer Architecture: Storage Duration¶

Image

The computer has memory types similar to those of humans:

  • CPUs and GPUs have small registers and cache memory (ultra-short-term memory)
  • RAM is volatile memory, i.e., its contents are lost when powered off (short-term memory)
  • The HDD/SSD is non-volatile storage, i.e., its contents remain (long-term memory)

CPU – Central Processing Unit¶

  • The CPU is the computer's processing unit that processes data
  • It processes a sequence of instructions (a program)

  • A CPU consists of millions of transistors that are only a few nanometers in size (1000000nm=1cm)
  • A few transistors can perform only one logical operation

No description has been provided for this image
https://www.ial-fa.com/blog/wafer-lot-acceptance-to-mil-std-883

Binary Numbers¶

  • Computers store, process & communicate data as binary numbers, because transistors in a gate can only perform logical operations.

  • binarius – dual, double

  • The smallest possible (useful) system of characters

  • Possible representations of binary code:

    • 0 / 1
    • False / True
    • Off / On

Note: The Difference in Computing¶

Due to the binary representation, common unit prefixes such as kilo-, mega-, etc. are defined based on 1024 rather than 1000.

Unit Abbreviation Decimal Value Binary (IEC) Abbreviation Binary (Bytes)
Kilobyte kB 1,000 Kibibyte KiB 1,024
Megabyte MB 1,000,000 Mebibyte MiB 1,048,576
Gigabyte GB 1,000^3 Gibibyte GiB 1,024^3
Terabyte TB 1,000^4 Tebibyte TiB 1,024^4

Lecture Hall Question¶

How far can you count with ten fingers?

No description has been provided for this image
Midjourney: Counting with two hands

Binary Numbers - Integers¶

  • Our decimal numbers can be encoded as binary numbers

  • Binary numbers allow the same well-known basic arithmetic operations as decimal numbers, namely addition, subtraction, multiplication, and division

  • This is how the computer can perform calculations with decimal numbers

  • In computers, numbers are also often encoded in hexadecimal (base 16), since a byte (8 bits) can be represented by two characters

Decimal Binary Hexadecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

Binary Numbers – Floating-Point¶

  • Real numbers cannot be represented exactly in a computer, because they can have infinitely many decimal digits (e.g., $1/3$, $\pi$)

  • Computers therefore use approximate floating-point numbers in exponential notation: $\pm m \times 2^e$

  • Decomposition: sign bit, exponent (with bias), mantissa (binary)

⚠️ Attention: Limited number of digits → rounding errors!

Example: We want to represent the number $-13.25$ as a floating-point number in the format $\pm m \times 2^e$:

  1. Sign: The number is negative, so 1.
  2. Decimal number in binary form: $13.25_{10} = 1101.01_2$
  3. Exponent shift: $1101.01_2 = 1.10101_2 \times 2^3$
  4. Decomposition into mantissa: $1.10101_2$ and exponent: $3$
  5. Result: $-13.25 = -1.10101_2 \times 2^3$

In the IEEE 754 standard the bits are padded with zeros so that they fit into 32- or 64-bit representations.

  • Sign bit: 1 (negative)

  • Exponent with bias: 3 + 127 = 130_{10}$ (10000010_2)

  • Mantissa padded with zeros: 10101000000000000000000

  • The binary representation in memory is therefore: 1 10000010 10101000000000000000000

Character Representation in Computers¶

  • Characters in text are encoded in binary in computers

  • ASCII: Text characters are stored in 8 binary values (8 bits = 1 byte)

  • Binary encoding extends from the lowest hardware level up to everyday applications

Char Decimal Binary Char Decimal Binary Char Decimal Binary
a 97 01100001 A 65 01000001 0 48 00110000
b 98 01100010 B 66 01000010 1 49 00110001
c 99 01100011 C 67 01000011 2 50 00110010
d 100 01100100 D 68 01000100 3 51 00110011
e 101 01100101 E 69 01000101 4 52 00110100
f 102 01100110 F 70 01000110 5 53 00110101
g 103 01100111 G 71 01000111 6 54 00110110
h 104 01101000 H 72 01001000 7 55 00110111
i 105 01101001 I 73 01001001 8 56 00111000
j 106 01101010 J 74 01001010 9 57 00111001
k 107 01101011 K 75 01001011 ! 33 00100001
l 108 01101100 L 76 01001100 ? 63 00111111
m 109 01101101 M 77 01001101 . 46 00101110
n 110 01101110 N 78 01001110 , 44 00101100
o 111 01101111 O 79 01001111 Space 32 00100000

Image Representation in Computers¶

  • Images are also stored in binary form in a computer

  • In this process, an image is divided into pixels (resolution)

  • The color in each pixel is then stored as a number, e.g., true color RGB (16,777,216 color variations):

    • Blue – 0 … 256 (= 1 Byte)
    • Green – 0 … 256 (= 1 Byte)
    • Red – 0 … 256 (= 1 Byte)
  • The numbers are then encoded in binary, e.g., as 24 bits (1 Byte = 8 Bits; 3 × 8 Bits = 24 Bits)

Image
Mahmut Sinecen: Digital Image Processing with MATLAB, 2015

Attention: The Difference in Computing¶

Due to the binary representation, common unit prefixes such as kilo-, mega-, etc. are defined on the basis of 1024 and not on the basis of 1000

Unit Binary Name Decimal (base-1000) Decimal, written out Binary (base-1024) Binary, written out
Kilobyte Kibibyte 1 KB = $10^3$ B 1,000 B 1 KiB = $2^{10}$ B 1,024 B
Megabyte Mebibyte 1 MB = $10^6$ B 1,000,000 B 1 MiB = $2^{20}$ B 1,048,576 B
Gigabyte Gibibyte 1 GB = $10^9$ B 1,000,000,000 B 1 GiB = $2^{30}$ B 1,073,741,824 B
Terabyte Tebibyte 1 TB = $10^{12}$ B 1,000,000,000,000 B 1 TiB = $2^{40}$ B 1,099,511,627,776 B

Data Growth¶

  • The amount of data generated is increasing.
  • In the future you will face large amounts of data.
  • The computer must help you analyze this data using computer science
Image
Worldwide IDC Global DataSphere Forecast, 2022–2026

Lecture Hall Question¶

How many sensors does a supermarket have?

No description has been provided for this image
Midjourney: An alien supermarket filled with exotic food

Example – Tesco Ireland¶

  • The supermarket chain Tesco invested early in sensors and monitoring systems across its stores with the goal of saving energy.
  • The collected data grew so quickly and to such a scale that no one could analyze it.
  • Using machine learning models, IBM Research was able to analyze the data and helped them cut cooling demand by 20%.
Tesco

Lessons Learned¶

  • "Lessons Learned" are short off-topic digressions that I wish someone had told me about when I was a student

  • Usually in the middle of lectures to lighten things up

  • This semester has focused primarily on soft-skills topics; next semester, survival tips for the professional world

No description has been provided for this image
DALL-E 2: Teddy bears mixing sparkling chemicals as mad scientists, steampunk

Lesson Learned¶

What types of memory are you familiar with?

No description has been provided for this image
DALL-E 2: 1980s illustration of a face with a visible brain that’s exploding

Lessons Learned - Memory¶

Gedaechnisarten
  • Knowledge takes time to consolidate.
  • Tap into your subconscious, i.e., gather information and let it mature.
  • Interval learning is, just as in sports, the most effective way to learn something in the long term.

Questions?

programmierung
und datenbanken