Metric Prefixes and Hertz
Notes
- We need some semi-specialized "mathy" things.
- We tend to measure very large and very small things.
- Clocks run in the billions of cycles per second.
- We tend to have trillions or more bytes of storage
- instructions take less than 1x10-9 seconds to complete
- To make it easier to compute, we tend to use the Metric Prefix system.
- Look this up on Wikipedia.
- There is the base unit, say byte
- There are units for larger collections
- There are larger units as well, exa, zetta, yotta, ronna, quetta but we are less likely to use these.
- So 1x109 bytes = 1 GB
- We tend to like things in the 1- 999 value range
- So 1,000,000 bytes is bad, but 1 gigabyte is acceptable.
Name Symbol Conversion Factor kilo k 1000, 103 mega M 106 giga G 109 tera T 1012 peta P 1015 - And there are smaller units
- Again we like numbers in the 1-999 range,
- if something takes .001 seconds, we say it takes 1 ms
.001 seconds = 1x10-3 seconds 1 ms = 1x10-3s 1 ms = 1x10-3s x -------- 1x10-3s 1 ms = 1x10-3sx -------- 1x10-3s= 1 ms - Do I need to show that work?
- Well, but don't goof it up.
- And we will probably be in the middle of a larger computation
- So just put it down.
- I often goof up the wiggle the decimal point method.
Name Symbol Conversion Factor mili m 1000, 10-3 micro μ 10-6 nano n 10-9 pico p 10-12
- Bytes, kilobytes and kibibytes.
- This is pedantic and does not matter in most of the rest of the world.
- Technically a kilo is 103 of the base unit.
- But because the base 2 is so embedded in the computing world, we used 210
-
n : k 10n 2k 10n/2k 3 : 10 1,000 1024 .9766 6 : 20 1,000,000 1,048,576 .9537 9 : 30 1,000,000,000 1,073,741,824 .9312 12 : 40 1,000,000,000,000 1,099,511,627,776 .9095 - There was a lawsuit
- Plus some general unhappiness with the inaccuracy
- So the multiple-byte units were introduced.
Name Symbol Conversion Factor kibibyte KiB 1024, 210 mebibyte MiB 220 gibibyte GiB 230 tebibyte TiB 240 pebibyte PiB 250 - Hertz (Hz)
- 1 Hz is 1 cycle/ second
- Or 1 event per second.
- A normal clock "ticks" at 1 Hz
- This is a measure of frequency
- it is expected that you will use metric prefixes with this unit
- So 1 kHz is 1000 events per second.
- Modern clocks are measured in GHz units.
- Apparently the Intel Core i9 processor 14900KS is the current highest clock rate processor that Intel makes.
- see https://www.intel.com/content/www/us/en/products/sku/237504/intel-core-i9-processor-14900ks-36m-cache-up-to-6-20-ghz/specifications.html (no link as the page does not pass the wave test.)
- It runs at 6.2GHz
- For clocks we care about:
- The frequency or how often it "ticks" every second
- Measured in Hertz
- The period or how long a single "tick" takes.
- Measured in seconds.
-
(Mattias Campe, via Wikipedia)
- In this image
- The clock rates are 1Hz, 2Hz and 3Hz.
- The periods are 1 second/cycle, 1/2 second/cycle, 1/3 second/cycle
- Notice that the period and frequency are inverses
- < pre> 2 cycles 2Hz = -------- 1 second The inverse is 1 second -------- or 1/2 second/cycle 2 cycles
- Some versions of the Arduino Nano have a 16MHz clock. How long is each clock cycle.
Since the clock speed is 16MHz I have MHz I want seconds/cycle 1x106 cycles 16 MHz = ------------ 1 second So a single cycle lasts 1 second ------------ 1x106 cycles = 1/16 x 10-6 seconds / cycle At this point we will drop the /cycle, as that is what we are discussing = .0625 x 10-6 seconds = 62.5 x 10-9 seconds I am not allowed to talk about 10-9 seconds so 1 second = 109 nanoseconds (ns) 1 x109ns = 62.5 x10-9 secondsx ------------ 1second= 62.5 ns (per cycle)
- You will frequently need to think about
- What are the conversion units I need.
- What "side up" do I want the fraction
- On your own, Find the speed of your processor and compute the length of time for each cycle. This will most likely yield an answer in the picosecond range.