2021-11-15 14:01:58 +01:00
|
|
|
<link rel="stylesheet" href="./static/main.css"/>
|
|
|
|
|
|
|
|
<!-- .slide: data-background-color="#283681" -->
|
|
|
|
|
|
|
|
# ITGK Teori-kurs
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<img src="./static/graphics/PVV-logo-blue.svg" width=30%/>
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
Note: Introduksjon
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## <span class="red">⏺ **OBS:** Opptak</span>
|
|
|
|
|
|
|
|
Note:
|
|
|
|
PVV sin youtube-kanal
|
|
|
|
|
|
|
|
selv-introduksjon
|
|
|
|
|
|
|
|
Angående forelesningen
|
|
|
|
|
2021-11-18 14:06:30 +01:00
|
|
|
Planen min er å gå over de fleste temaene nevnt i pensum.
|
|
|
|
|
|
|
|
Skape "Aha!"-momenter
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Kommer til å nevne en del biter som ikke nødvendigvis er viktig for pensum,
|
2021-11-18 14:06:30 +01:00
|
|
|
men som er viktig for å forstå innholdet.
|
2021-11-15 22:01:28 +01:00
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
## Generelt
|
|
|
|
|
|
|
|
Hva er IT
|
|
|
|
|
|
|
|
Kort Historie
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
### Folk som er viktige
|
|
|
|
|
|
|
|
<!-- TODO: Add people and pictures -->
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
- Von Neumann
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
<!-- .slide: data-auto-animate -->
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
### Et par begreper:
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
<div class="columns">
|
2021-11-15 22:01:28 +01:00
|
|
|
<div>
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 18:26:51 +01:00
|
|
|
- PC <!-- .element: data-id="pc" -->
|
|
|
|
- Operativsystem
|
|
|
|
- Abstraksjon
|
2021-11-15 14:01:58 +01:00
|
|
|
- Transistorer
|
|
|
|
- IC
|
|
|
|
|
|
|
|
</div>
|
2021-11-15 22:01:28 +01:00
|
|
|
<div>
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 18:26:51 +01:00
|
|
|
- Hardware
|
|
|
|
- Software
|
2021-11-15 14:01:58 +01:00
|
|
|
- Kernel
|
2021-11-18 14:06:30 +01:00
|
|
|
- Protokoll
|
2021-11-15 14:01:58 +01:00
|
|
|
- WWW/Internet
|
|
|
|
- High level/Low level
|
2021-11-15 18:26:51 +01:00
|
|
|
- bit
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
Note:
|
|
|
|
Operativsystem -> Ressursallokering -> Kernel -> Grafisk brukergrensesnitt
|
|
|
|
|
2021-11-18 14:06:30 +01:00
|
|
|
Forklar hvordan en transistor funker
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
----
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
<!-- .slide: data-auto-animate data-transition="zoom-in" -->
|
|
|
|
|
|
|
|
<div class="columns">
|
|
|
|
<div>
|
2021-11-15 18:26:51 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
- PC <!-- .element: data-id="pc" -->
|
2021-11-15 18:26:51 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
----
|
|
|
|
|
|
|
|
---
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
|
|
|
|
|
|
|
| Enhet | Størrelse |
|
|
|
|
|------------|-------------------|
|
|
|
|
| byte | 8 bits |
|
2021-11-22 00:12:51 +01:00
|
|
|
| kilobyte | \\(10^3=1000\\) bytes |
|
2021-11-15 14:01:58 +01:00
|
|
|
| megabyte | \\(10^6\\) bytes |
|
|
|
|
| gigabyte | \\(10^9\\) bytes |
|
|
|
|
| terabyte | \\(10^{12}\\) |
|
|
|
|
| petabyte | \\(10^{15}\\) |
|
2021-11-22 00:12:51 +01:00
|
|
|
| exabyte | \\(10^{18}\\) |
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
</div>
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="column fragment">
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
| Enhet | Størrelse |
|
|
|
|
|------------|-------------------|
|
|
|
|
| byte | 8 bits |
|
2021-11-22 00:12:51 +01:00
|
|
|
| kibibyte | \\(2^{10} = 1024\\) bytes |
|
|
|
|
| mebibyte | \\(2^{20}\\) bytes |
|
|
|
|
| gibibyte | \\(2^{30}\\) bytes |
|
|
|
|
| tebibyte | \\(2^{40}\\) |
|
|
|
|
| pebibyte | \\(2^{50}\\) |
|
|
|
|
| exbibyte | \\(2^{60}\\) |
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
### Datatyper
|
|
|
|
|
|
|
|
- Integer
|
|
|
|
- Character
|
|
|
|
- Float
|
|
|
|
- Array
|
|
|
|
- String
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
char -> ASCII 7b, Extended ASCII 8b, UTF-8
|
|
|
|
|
|
|
|
Finnes flere, men disse
|
|
|
|
|
|
|
|
Objekter
|
|
|
|
|
2021-11-18 14:06:30 +01:00
|
|
|
----
|
|
|
|
|
|
|
|
### ASCII, UNICODE, UTF-8
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
---
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<!-- .slide: center=false -->
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
### Tallsystemer
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="num-systems">
|
|
|
|
|
|
|
|
<div class="fragment" data-fragment-index="0">
|
|
|
|
<span class="num-system-title">10:</span>
|
|
|
|
<span class="num-span-red">
|
|
|
|
<span>0</span>,
|
|
|
|
<span>1</span>,
|
|
|
|
<span>2</span>,
|
|
|
|
<span>3</span>,
|
|
|
|
<span>4</span>,
|
|
|
|
<span>5</span>,
|
|
|
|
<span>6</span>,
|
|
|
|
<span>7</span>,
|
|
|
|
<span>8</span>,
|
|
|
|
<span>9</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-blue">
|
|
|
|
<span>10</span>,
|
|
|
|
<span>11</span>,
|
|
|
|
<span>12</span>, ...,
|
|
|
|
<span>19</span>,
|
|
|
|
<span>20</span>,
|
|
|
|
<span>21</span>, ...,
|
|
|
|
<span>99</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-green">
|
|
|
|
<span>100</span>,
|
|
|
|
<span>101</span>, ...
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="fragment" data-fragment-index="1">
|
|
|
|
<span class="num-system-title">2:</span>
|
|
|
|
<span class="num-span-red">
|
|
|
|
<span>0</span>,
|
|
|
|
<span>1</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-blue">
|
|
|
|
<span>10</span>,
|
|
|
|
<span>11</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-green">
|
|
|
|
<span>100</span>,
|
|
|
|
<span>101</span>,
|
|
|
|
<span>110</span>,
|
|
|
|
<span>111</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-orange">
|
|
|
|
<span>1000</span>,
|
|
|
|
<span>1001</span>,
|
|
|
|
<span>1010</span>,
|
|
|
|
<span>1011</span>, ...
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="fragment" data-fragment-index="2">
|
|
|
|
<span class="num-system-title">16:</span>
|
|
|
|
<span class="num-span-red">
|
|
|
|
<span>0</span>,
|
|
|
|
<span>1</span>,
|
|
|
|
<span>2</span>,
|
|
|
|
<span>3</span>,
|
|
|
|
<span>4</span>,
|
|
|
|
<span>5</span>,
|
|
|
|
<span>6</span>,
|
|
|
|
<span>7</span>,
|
|
|
|
<span>8</span>,
|
|
|
|
<span>9</span>,
|
|
|
|
<span>A</span>,
|
|
|
|
<span>B</span>,
|
|
|
|
<span>C</span>,
|
|
|
|
<span>D</span>,
|
|
|
|
<span>E</span>,
|
|
|
|
<span>F</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-blue">
|
|
|
|
<span>10</span>,
|
|
|
|
<span>11</span>,
|
|
|
|
<span>12</span>, ...,
|
|
|
|
<span>1E</span>,
|
|
|
|
<span>1F</span>,
|
|
|
|
<span>20</span>, ...,
|
|
|
|
<span>FE</span>,
|
|
|
|
<span>FF</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-green">
|
|
|
|
<span>100</span>, ...
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="fragment" data-fragment-index="3">
|
|
|
|
<span class="num-system-title">8:</span>
|
|
|
|
<span class="num-span-red">
|
|
|
|
<span>0</span>,
|
|
|
|
<span>1</span>,
|
|
|
|
<span>2</span>,
|
|
|
|
<span>3</span>,
|
|
|
|
<span>4</span>,
|
|
|
|
<span>5</span>,
|
|
|
|
<span>6</span>,
|
|
|
|
<span>7</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-blue">
|
|
|
|
<span>10</span>,
|
|
|
|
<span>11</span>,
|
|
|
|
<span>12</span>, ...,
|
|
|
|
<span>76</span>,
|
|
|
|
<span>77</span>,
|
|
|
|
</span>
|
|
|
|
<span class="num-span-green">
|
|
|
|
<span>100</span>, ...
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
Forventet å kunne octal, binær, heksadesimal
|
|
|
|
|
|
|
|
går tom for siffer
|
|
|
|
|
|
|
|
delbarhet
|
|
|
|
|
|
|
|
hexadesimal i 4 binær chunks om gangen
|
|
|
|
octal i 3 binær chunks om gangen
|
|
|
|
revers
|
|
|
|
|
|
|
|
lurt å trene på
|
|
|
|
|
|
|
|
brukt ca. 20 min
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
----
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
### Eksempel: 1110010111011011
|
|
|
|
|
|
|
|
<!-- TODO: Add labels to conversion fields (8 and 16) -->
|
|
|
|
|
|
|
|
<img src="./static/graphics/digit-conversion.svg" width="70%"/>
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
### Negative tall
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
- Signed magnitude
|
|
|
|
- Two's compliment
|
|
|
|
|
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
Signed magnitude
|
|
|
|
|
|
|
|
bruker første biten
|
|
|
|
|
|
|
|
0000 = 1000
|
|
|
|
kaster bort en plass
|
|
|
|
|
|
|
|
Løsning: Twos complement:
|
|
|
|
|
|
|
|
0001 = 1
|
|
|
|
0000 = 0
|
|
|
|
1111 = -1
|
|
|
|
|
|
|
|
1000 = MIN_INT
|
|
|
|
|
|
|
|
Algoritme:
|
|
|
|
- finn ut hva minste negative tall er
|
|
|
|
- ta resten av bitsene, og konverter til desimal
|
|
|
|
- regn ut offsett
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-18 14:06:30 +01:00
|
|
|
### Flyttall - IEEE 754
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
>>> 0.1 + 0.2
|
|
|
|
0.30000000000000004
|
|
|
|
```
|
|
|
|
|
|
|
|
<img src="./static/graphics/floating-point-structure.svg" width=80%/> <!-- .element: class="fragment" data-fragment-index="1" -->
|
|
|
|
|
|
|
|
\\[ (+,\ \ 4,\ \ 1949284) = +1.949284 \cdot 10^4 = 19492.84 \\] <!-- .element: class="fragment" data-fragment-index="2" -->
|
|
|
|
|
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
Matematisk tilnærming
|
|
|
|
|
|
|
|
Signed bit, exponent - 2^?, signifikant?
|
|
|
|
|
|
|
|
består av 3 biter, kan gi rare utregninger iblant
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Opphøyd i 10, men i virkeligheten opphøyd i 2
|
|
|
|
|
|
|
|
Ikke veldig viktig, men kan være oppklarende.
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# Hardware
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
<!-- TODO: add toc -->
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
- Hovedkort
|
|
|
|
- CPU
|
|
|
|
- Minne
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
# Datamaskin
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Note:
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
Består av mange forskjellige biter.
|
|
|
|
datamaskin er bare et begrep vi bruker.
|
|
|
|
Kan gå galt på veldig mange lag i prosessen.
|
|
|
|
Moores law, antall transistorer i en IC dobles hver 2. år.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Hovedkort (Motherboard)
|
|
|
|
|
|
|
|
<img src="./static/graphics/motherboard2.png" width="50%"/>
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Note:
|
|
|
|
|
|
|
|
Limet som fester alle de andre bitene sammen.
|
|
|
|
Inneholder litt logikk for konfigurasjon av alle bitene, men lite ellers.
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## CPU
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
<img src="./static/graphics/cpu.png" width=40%/>
|
|
|
|
<img src="./static/graphics/processor.gif" width=40%/>
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
Viktigste biten. Gjør alle beregningene.
|
|
|
|
Består av 3 biter, kontrollenhet, minneenhet, ALU
|
|
|
|
Kjører raskt, gHz
|
|
|
|
Har et visst sett med ting den kan gjøre, kalt et instruksjonssett.
|
|
|
|
Setter du disse på rad, så har du et program.
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
----
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
### Fetch-Decode-Execute Cycle
|
|
|
|
|
|
|
|
<table style="font-size: 0.8em;" width="80%">
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<div class="fde-table-item bak-blue">FETCH</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<ul>
|
|
|
|
<li>Henter neste instruksjon</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="fragment" data-fragment-index="1">
|
|
|
|
<td>
|
|
|
|
<div class="fde-table-item bak-yellow">DECODE</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<ul>
|
|
|
|
<li>Dekoder instruksjonen</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="fragment" data-fragment-index="2">
|
|
|
|
<td>
|
|
|
|
<div class="fde-table-item bak-red">EXECUTE</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<ul>
|
|
|
|
<li>Henter verdier fra minnet</li>
|
|
|
|
<li>Utfører instruksjonen</li>
|
|
|
|
<li>Skriver svaret tilbake i minnet</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="fragment" data-fragment-index="3" style="padding: 0 20%; font-size: 1.5em">
|
|
|
|
|
|
|
|
```python
|
|
|
|
>>> x += y
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
### Pipelining
|
|
|
|
|
|
|
|
<div class="fde-grid">
|
|
|
|
<span class="fde-item bak-blue">FE</span>
|
|
|
|
<span data-fragment-index="1" class="fragment bak-yellow">DE</span>
|
|
|
|
<span data-fragment-index="3" class="fragment bak-red">EX</span>
|
|
|
|
<span data-fragment-index="2" class="fragment fde-r2 fde-c2 bak-blue">FE</span>
|
|
|
|
<span data-fragment-index="4" class="fragment fde-r2 fde-c3 bak-yellow">DE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r2 fde-c4 bak-red">EX</span>
|
|
|
|
<span data-fragment-index="5" class="fragment fde-r3 fde-c3 bak-blue">FE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r3 fde-c4 bak-yellow">DE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r3 fde-c5 bak-red">EX</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r4 fde-c4 bak-blue">FE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r4 fde-c5 bak-yellow">DE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r4 fde-c6 bak-red">EX</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r5 fde-c5 bak-blue">FE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r5 fde-c6 bak-yellow">DE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r5 fde-c7 bak-red">EX</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r6 fde-c6 bak-blue">FE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r6 fde-c7 bak-yellow">DE</span>
|
|
|
|
<span data-fragment-index="6" class="fragment fde-r6 fde-c8 bak-red">EX</span>
|
|
|
|
</div>
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
*5 steg* hver gang den skal kjøre en instruksjon
|
|
|
|
|
|
|
|
PC - program counter
|
|
|
|
Branching - hopp til andre steder/loop
|
|
|
|
Kjører en instruksjon for hver klokkesykel, men gjør flere steg samtidig. Verdt å merke seg.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Minne
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
<div class="columns" style="font-size: 0.6em;">
|
|
|
|
<div>
|
|
|
|
<h3>Primary</h3>
|
|
|
|
|
|
|
|
- Volatile
|
|
|
|
- Random Access
|
|
|
|
|
|
|
|
<img src="./static/graphics/ram.png" width=80% />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<h3>Secondary</h3>
|
|
|
|
|
|
|
|
- Nonvolatile
|
|
|
|
- Sequential Access?
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<img src="./static/graphics/storage_combined.svg" width=60% />
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
Primær - RAM
|
|
|
|
tilfeldig access - kan nå hvor som helst øyeblikkelig
|
|
|
|
volatilt - uten strøm så forsvinner dataen.
|
|
|
|
|
|
|
|
Sekundær - Harddisk
|
|
|
|
Tregt - cd som spinner
|
|
|
|
Sekvensiell aksess - Må lete for å lese på riktig sted.
|
|
|
|
ikke volatilt - holder på data uten strøm
|
|
|
|
SSD - Nesten random access, ligner på ram, men er ikke volatil
|
|
|
|
CD, DVD, Ekstern harddisk, USB, osv.
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
---
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
# Digital Representasjon
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
## Analog/Digital
|
|
|
|
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<img src="./static/graphics/sound-points-white.svg" width=100%/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
|
|
|
|
- ADC - inn på computeren
|
|
|
|
- DAC - ut fra computeren
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
Analog kan du måle bortimot så nøyaktig du vil
|
|
|
|
Digital har et visst sett med 0 og 1
|
|
|
|
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
---
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
## Piksler
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
|
|
|
<img src="./static/graphics/subpixel.svg" width=30%/>
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<img src="./static/graphics/e.jpg" width=100%/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
Note:
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
Piksler er en måte å representere bilder
|
|
|
|
En piksel er en liten bit av bildet, med en farge.
|
|
|
|
Ofte tilsvarer 1 piksel 1 LED på skjermen
|
|
|
|
Den fargen er representert som en sammensetning av 3 farger
|
|
|
|
Pleier ofte å være RGB
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
<h3>
|
|
|
|
<span class="rgb-red">R</div><span class="rgb-gre">G</div><span class="rgb-blu">B</div>
|
|
|
|
<span style="width: 10%; display: inline-block;"/>
|
|
|
|
<img style="vertical-align:middle;" src="./static/graphics/subpixel.svg" width=40%/>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
Hver verdi er mellom 0 og 255
|
|
|
|
|
|
|
|
Kan derfor representeres som et hexadecimal med 6 tegn
|
|
|
|
|
|
|
|
<div class="replacable-fragment" style="font-size: 0.8em;">
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="fragment fade-out" data-fragment-index="1">
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
| Farge | <span class="rgb-red">Rød</span> | <span class="rgb-gre">Grønn</span> | <span class="rgb-blu">Blå</span> |
|
2021-11-15 14:01:58 +01:00
|
|
|
|--------------------------------------|---------------|---------------|---------------|
|
|
|
|
| <span class="rgb-pvv">#283681</span> | 28\\(_{16}\\) | 36\\(_{16}\\) | 81\\(_{16}\\) |
|
|
|
|
| <span class="rgb-red">#FF0000</span> | FF\\(_{16}\\) | 00\\(_{16}\\) | 00\\(_{16}\\) |
|
|
|
|
| <span class="rgb-cof">#C0FFEE</span> | C0\\(_{16}\\) | FF\\(_{16}\\) | EE\\(_{16}\\) |
|
|
|
|
| <span class="rgb-whi">#FFFFFF</span> | FF\\(_{16}\\) | FF\\(_{16}\\) | FF\\(_{16}\\) |
|
|
|
|
| <span class="rgb-bla">#000000</span> | 00\\(_{16}\\) | 00\\(_{16}\\) | 00\\(_{16}\\) |
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
</div>
|
|
|
|
<div class="fragment fade-in" data-fragment-index="1">
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
| Farge | <span class="rgb-red">Rød</span> | <span class="rgb-gre">Grønn</span> | <span class="rgb-blu">Blå</span> |
|
2021-11-15 14:01:58 +01:00
|
|
|
|--------------------------------------|----------------|----------------|----------------|
|
|
|
|
| <span class="rgb-pvv">#283681</span> | \\(40_{10}\\) | \\(54_{10}\\) | \\(129_{10}\\) |
|
|
|
|
| <span class="rgb-red">#FF0000</span> | \\(255_{10}\\) | \\(0_{10}\\) | \\(0_{10}\\) |
|
|
|
|
| <span class="rgb-cof">#C0FFEE</span> | \\(192_{10}\\) | \\(255_{10}\\) | \\(238_{10}\\) |
|
|
|
|
| <span class="rgb-whi">#FFFFFF</span> | \\(255_{10}\\) | \\(255_{10}\\) | \\(255_{10}\\) |
|
2021-11-15 22:01:28 +01:00
|
|
|
| <span class="rgb-bla">#000000</span> | \\(0_{10}\\) | \\(0_{10}\\) | \\(0_{10}\\) |
|
2021-11-15 14:01:58 +01:00
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
</div>
|
2021-11-15 14:01:58 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
Regn ut 1920x1080 x 24 bits
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
## Lyd
|
|
|
|
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
|
|
|
|
|
|
|
<img src="./static/graphics/sound-points-white.svg" width=100%/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
|
|
|
|
- Bør være dobbelt så ofte som høyeste frekvensen
|
|
|
|
- Bitdybde (16 bit er standard)
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
\\[ 16\ bits \cdot 44100\ Hz \cdot (3 \cdot 60)s \cdot 2\ kanaler \\]
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
Note:
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
tegn en bølge på tavlen, og vis frekvensen
|
2021-11-17 02:16:07 +01:00
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
## Encoding og Komprimering
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
- "Hvordan tolke dataen"
|
2021-11-15 22:01:28 +01:00
|
|
|
- Lossless vs lossy
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
Alt er 1 og 0, men det kan tolkes på forskjellige måter.
|
|
|
|
|
|
|
|
Grunnen til at de ofte diskuteres sammen
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
### Eksempel på komprimering
|
|
|
|
|
|
|
|
\\[ AAAAAAABBBBAAAAABB \\]
|
|
|
|
|
|
|
|
\\[ A6B4A5B2 \\] <!-- .element: class="fragment" data-fragment-index="1" -->
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
Note:
|
|
|
|
|
|
|
|
Rart for tekst, men gir mening for bilder -> Runlength encoding
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
----
|
|
|
|
|
|
|
|
### Eksempel på lossy komprimering
|
|
|
|
|
|
|
|
Dette er en eksempelsetning.
|
|
|
|
|
|
|
|
Dte e en eksmplstnig <!-- .element: class="fragment" data-fragment-index="1" -->
|
|
|
|
|
|
|
|
Note:
|
|
|
|
ikke vanlig for tekst, men akseptabelt for video/lyd/bilde
|
2021-11-17 02:16:07 +01:00
|
|
|
Gjøres ofte på tjenester som messenger.
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
---
|
2021-11-15 14:01:58 +01:00
|
|
|
|
|
|
|
# Algoritmer
|
2021-11-15 22:01:28 +01:00
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
Note:
|
|
|
|
Beskriver stegvis og nøyaktig hvordan man løser et problem
|
|
|
|
Uten tolkning
|
|
|
|
Pseudokode
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
----
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
(Eksempel på pseudokode)
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
## Kompleksitet
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<table width="100%">
|
2021-11-17 02:16:07 +01:00
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
\\[ \mathcal{O}(1) \\]
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
```python
|
|
|
|
def f(lst):
|
|
|
|
print('Hi!')
|
|
|
|
```
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
\\[ \mathcal{O}(n) \\]
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
```python
|
|
|
|
def f(lst):
|
|
|
|
for item in lst:
|
|
|
|
print(item)
|
|
|
|
```
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
\\[ \mathcal{O}(n^2) \\]
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
```python
|
|
|
|
def f(lst):
|
|
|
|
for item in lst:
|
|
|
|
for itemOnceMore in lst:
|
|
|
|
print(item, itemOnceMore)
|
|
|
|
```
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
Note:
|
|
|
|
brukes mer om dere skal programmere mye
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
Sorteringsalgortimer:
|
|
|
|
|
|
|
|
- Bubble sort: \\(\mathcal{O}(n^2)\\)
|
|
|
|
- Merge sort : \\(\mathcal{O}(n\ log\ n)\\)
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
---
|
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
# Nettverk
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Internett
|
|
|
|
|
|
|
|
- Hva er det
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
### Historie
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
- ARPAnet
|
|
|
|
|
|
|
|
Note:
|
|
|
|
Sponset av Dep. of defense, USA
|
|
|
|
Kjellermaskiner, matte
|
|
|
|
Ble ikke brukt aktivt hele tiden
|
|
|
|
Overføre instruksjoner
|
|
|
|
Maksimal utnyttelse
|
|
|
|
Flere universiteter koblet seg på
|
|
|
|
Ikke veldig planlagt
|
|
|
|
|
2021-11-15 22:01:28 +01:00
|
|
|
---
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
### 5 lags modellen
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/network-stack.svg" width=40%/>
|
|
|
|
</div>
|
|
|
|
<div class="r-stack">
|
|
|
|
<img src="./static/graphics/network-layers/5/packet.svg" class="fragment fade-out" data-fragment-index="0" width=20%/>
|
|
|
|
<img src="./static/graphics/network-layers/4/packet.svg" class="fragment current-visible" data-fragment-index="0" width=30%/>
|
|
|
|
<img src="./static/graphics/network-layers/3/packet.svg" class="fragment current-visible" data-fragment-index="1" width=40%/>
|
|
|
|
<img src="./static/graphics/network-layers/2/packet.svg" class="fragment current-visible" data-fragment-index="2" width=50%/>
|
|
|
|
<img src="./static/graphics/network-layers/1/packet.svg" class="fragment current-visible" data-fragment-index="3" width=60%/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-17 02:16:07 +01:00
|
|
|
|
|
|
|
Note:
|
|
|
|
pakker
|
|
|
|
pakket inn i hverandre
|
2021-11-22 00:12:51 +01:00
|
|
|
Skal se litt på hva punktumene faktisk er
|
2021-11-17 02:16:07 +01:00
|
|
|
|
|
|
|
----
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<img src="./static/graphics/network-layers/1/title.svg" width="20%"/>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<img src="./static/graphics/network-layers/1/computer-diagram.svg"/>
|
2021-11-17 02:16:07 +01:00
|
|
|
|
|
|
|
Note:
|
|
|
|
Medium for kommunikasjon mellom 2 eller flere endrepunkter
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/2/title.svg" width="40%"/>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/1/computer-diagram.svg" class="prev-netdiagram" width="30%"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<img src="./static/graphics/network-layers/2/computer-diagram.svg"/>
|
2021-11-17 02:16:07 +01:00
|
|
|
|
|
|
|
Note:
|
|
|
|
Etablert: Kommunikasjonsmedium
|
|
|
|
|
|
|
|
Stabil overføring, og kontakt med andre ender
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/3/title.svg" width="40%"/>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/2/computer-diagram.svg" class="prev-netdiagram" width="30%"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<img src="./static/graphics/network-layers/3/computer-diagram.svg"/>
|
2021-11-17 02:16:07 +01:00
|
|
|
|
|
|
|
Note:
|
|
|
|
Etablert: Flere computere er koblet sammen
|
|
|
|
|
|
|
|
Kommunikasjon gjennom flere computere.
|
|
|
|
|
|
|
|
Oppfører seg litt som postkontorer
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
Hop count
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
----
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/4/title.svg" width="40%"/>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/3/computer-diagram.svg" class="prev-netdiagram" width="30%"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<img src="./static/graphics/network-layers/4/computer-diagram.svg" width="60%"/>
|
2021-11-17 02:16:07 +01:00
|
|
|
|
|
|
|
Note:
|
|
|
|
Etablert: Link over mange computere.
|
|
|
|
|
|
|
|
Stabil og sikker kommunikasjon til tross for forsvunnede pakker,
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
TODO: move hop count from Transport layer to network layer
|
|
|
|
|
2021-11-17 02:16:07 +01:00
|
|
|
----
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<div class="columns">
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/5/title.svg" width="40%"/>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<img src="./static/graphics/network-layers/4/computer-diagram.svg" class="prev-netdiagram" width="40%"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<br>
|
2021-11-18 00:04:33 +01:00
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
<img src="./static/graphics/network-layers/5/computer-diagram.svg" width="55%"/>
|
|
|
|
|
|
|
|
Note:
|
2021-11-17 02:16:07 +01:00
|
|
|
Etablert: Stabil og sikker kommunikasjon.
|
|
|
|
|
|
|
|
Applikasjonsspesifikk data.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
### MAC-Addresse
|
|
|
|
|
|
|
|
`B6-4B-8F-B4-05-E5`
|
|
|
|
|
|
|
|
<!-- TODO: Fix -->
|
|
|
|
<img class="right-corner-logo" src="./static/graphics/network-layers/2/title.svg">
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# IP
|
|
|
|
|
|
|
|
|
|
|
|
### IPv4
|
|
|
|
|
|
|
|
`ddd.ddd.ddd.ddd`
|
|
|
|
`(bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb)`
|
|
|
|
|
|
|
|
### IPv6
|
|
|
|
|
|
|
|
`xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`
|
|
|
|
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
Navn på pcene
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
### Submaske
|
|
|
|
|
|
|
|
`255.255.255.128`
|
|
|
|
|
|
|
|
`(11111111.11111111.11111111.10000000)`
|
|
|
|
|
|
|
|
`192.168.0.128`<span class="red">`/25`</span>
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
Den siste er ikke veldig nyttig, men om man skal sette opp ruter
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
NAT
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
### DNS
|
|
|
|
|
|
|
|
NTNU: <a href="https://129.241.160.102/">129.241.160.102</a>
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
TCP
|
2021-11-17 02:16:07 +01:00
|
|
|
|
2021-11-22 00:12:51 +01:00
|
|
|
----
|
|
|
|
|
|
|
|
UDP
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
VPN
|
|
|
|
|
|
|
|
---
|
2021-11-15 22:01:28 +01:00
|
|
|
|
2021-11-15 14:01:58 +01:00
|
|
|
# Programvareutvikling
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-18 00:04:33 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
Løs tidligere eksamener
|
2021-11-15 22:01:28 +01:00
|
|
|
|
2021-11-18 00:04:33 +01:00
|
|
|
Crash course
|
2021-11-15 22:01:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|