hardware
Access times
from PC Mag.com and GKToday.in Access time examples from extremetech.com
Register
In a computer, a register is the fastest memory. Register a part of the computer processor which is used to hold a computer instruction, perform mathematical operation as storage address, or any kind of data.
Cache
Cache memory is extremely fast memory that is built into a computer’s central processing unit (CPU) that store information the CPU is most likely to need next. Which information is loaded into cache depends on sophisticated algorithms and certain assumptions about programming code. The goal of the cache system is to ensure that the CPU has the next bit of data it will need already loaded into cache by the time it goes looking for it (also called a cache hit).
A cache miss, on the other hand, means the CPU has to go scampering off to find the data elsewhere. This is where the L2 cache comes into play — while it’s slower, it’s also much larger. If data can’t be found in the L2 cache, the CPU continues down the chain to L3, then L4 (if it exists) and main memory (DRAM).
L1 cache access time example: 1ns
L2, cache access time example: 10ns
Memory
Memory access time is how long it takes for a character in RAM to be transferred to or from the CPU.
RAM chips access time example: 80-120ns . See SDRAM.
Disk
Disk access time is how long it takes to obtain the first data character after initiating a request. It includes the time to move the read/write head to the track (seek time) and time to rotate the platter to the sector (latency). Disk access time is always given as an average, because seek time and latency vary depending on the current position of the head and platter.
Disk vs. SSD
While access times of fast hard disks are typically from 5 to 10 milliseconds, solid state drive (SSD) access times are in the 25 to 100 microsecond range. SSDs are as much as 100 times faster because there is no mechanical seek time or latency associated with flash memory storage. However, access times for all storage types are only one metric. Channel speed (transfer rate) and caching contribute to overall storage performance. See cache, seek time and latency.
What is a disk?
From techtarget.com: A hard disk is part of a unit -- often called a disk drive, hard drive or hard disk drive -- that stores and provides relatively quick access to large amounts of data on an electromagnetically charged surface or set of surfaces. Today's computers typically come with a hard disk that can contain anywhere from billions to trillions of bytes of storage.
A hard disk is actually a set of stacked disks, like phonograph records. Each disk has data recorded electromagnetically in concentric circles, or tracks, on the disk. A head, similar to a phonograph arm but in a relatively fixed position, writes or reads the information on the tracks. Two heads, one on each side of a disk, read or write the data as the disk spins. Each read or write operation requires that data be located, an operation called a seek. Data already in a disk cache, however, will be located more quickly.
A hard disk/drive unit comes with a set rotation speed varying from 4,200 revolutions per minute to 15,000 rpm. Most laptop and desktop PCs use hard disks that fall between 5,400 rpm and 7,200 rpm, while hard disks at higher rpm can be found in high-end workstations and enterprise servers. Disk access time is measured in milliseconds. Although the physical location of data can be identified with cylinder, track and sector locations, these are actually mapped to a logical block address (LBA) that works with the larger address range on hard disks.
Hard disks remain a popular data storage option for consumers and enterprises, in spite of the growing popularity and rapidly lowering cost of nonvolatile solid-state flash memory in the form of solid-state drives (SSDs). SSDs fit into the same external and internal drive bays as their HDD counterparts. SSDs may be much faster, more durable and draw less power than hard disks, but they are also more expensive. SSDs are considered a better fit for applications that demand high performance, while HDDs are more often used for high-capacity use cases.
Multithreading
Multithreading is a technique that allows for concurrent (simultaneous) execution of two or more parts of a program for maximum utilization of a CPU. As a really basic example, multithreading allows you to write code in one program and listen to music in another. Programs are made up of processes and threads. You can think of it like this:
A program is an executable file like chrome.exe.
A process is an executing instance (copy) of a program. When you double click on the Google Chrome icon on your computer, you start a process which will run the Google Chrome program.
A thread is the smallest executable unit of a process. A process can have multiple threads with one main thread. In the example, a single thread could be displaying the current tab you’re in, and a different thread could be another tab.
Why use multithreading over multiple processes?
Creating a thread is much less expensive when compared to creating a new process, because the newly created thread uses the current process address space. The time it takes to switch between threads is much less than the time it takes to switch between processes, partly because switching between threads does not involve switching between address spaces.
Communicating between the threads of one process is simple because the threads share everything; address space, in particular. So, data produced by one thread is immediately available to all the other threads.
Example of multithreading
Think about a single processor that is running your IDE. Say you edit one of your code files and click save. When you click save, it will initiate a workflow which will cause bytes to be written out to the physical disk. However, reading or writing is an expensive operation (takes a long time), and the CPU will be idle while bytes are being written out to the disk.
While the writing takes place, the idle CPU could work on something useful and here is where threads come in - the write thread is switched out and the User Interface thread gets scheduled on the CPU so that if you click elsewhere on the screen, your IDE is still responsive and does not appear hung or frozen.
Threads can give the illusion of multitasking even though at any given point in time the CPU is executing only one thread.
Multi core CPU
With advances in hardware technology, it is now common to have multi-core machines. Applications can take advantage of these and have a dedicated CPU run each thread.
Most computers in 2018 are multi-core. Not all applications need multi-core and not all applications can access multi-core. As a general rule, any modern application will access the multi-core features of a Mac or PC if in fact it would make a positive difference to the user experience, e.g. by running faster, smoother, or with more data.
multi core CPU
multi core CPU running multithreaded process
Hyper threading
From pediaa.com: Hyper threading is a technology developed by Intel to increase the performance of the CPU/processor. It allows a single CPU to run two threads. On the other hand, multithreading is a mechanism that allows running multiple lightweight threads within a process at the same time. Each thread has their own program counter, stack, registers, etc.
It makes the operating system recognise each physical core as two virtual or logical cores. In other words, it virtually increases the number of cores in a CPU. Therefore, a single processor runs two threads. It is important to note that hyper threading really does not increase the number of cores – it just increases the cores virtually or logically. Each virtual core can work independently.
videos on multi core and multithreading
Htop
post 1st boot
check the OS version: $ cat /etc/os-release
update the packages: sudo apt-get update
sudo apt-get upgrade
install stress: sudo apt-get install stress
Virtual memory
Clock speed
Very long ago already. Someone already managed to overclock a Celeron D from 2010 to 8.2 GHz: Overclocker Pushes Intel's Celeron D to 8.20 GHz
The Hz value actually doesn’t show you the speed though. That’s just a clock rate. It says nothing about how fast any particular program can run, just how many instructions per second can be sent, not how many such cycles each instruction would take to complete.
Anyhow, it starts to run into a physical barrier at these sorts of clock rates. The speed of electricity moves through the metals is limited. Around half the speed of light. So a clock rate which is too high means the electricity doesn’t arrive at its destination quickly enough - causing corruptions as the value read would be wrong.
That’s irrespective if the heat and interference doesn’t already cause such corruption. Even if it was a super conductive material and there was no loss or trans-signal interference, this would still be a limiting factor.
So, how high can it get in theory? Well, let’s assume the absolute best case where electricity just has to flow in one straight line from one side of the CPU to the other. No twists and turns, loop-backs, and the like. Just one side to the other in one single straight “cable”:
A typical CPU (say some Core-i from Intel) is between 10 mm and 20 mm:
Take an average of 15 mm. That means the electricity needs to flow that 15 mm (at least) for each of those clock ticks. That speed being very close to 50% of C (the speed of light = 300 mega meters [Mm] per second). Meaning it’s (300 / 2) x 1000000 (Mm → m) x 1000 (m → mm) = 150 000 000 000 mm/s.
Then, to find out how many times it can go 15 mm in one second? 150 000 000 000 / 15 = 10 000 000 000 Hz = 10 GHz.
So in theory, such a CPU can reach an absolute maximum of 10 GHz if the pathways are all just straight through from one side to the other. That is never the case though. It would be a pretty useless processor if it just flowed the electricity from one side to the other.
And thus why you see lower clock rates instead. The more simplistic (less actual working components) and smaller the CPU is the higher this limit becomes.
That’s why that age-old, very small, and extremely simple Celeron could just about reach 8.2 GHz. But it required extreme cooling and wasn’t exactly stable at those rates.
Those other factors cause some serious problems even before you reach this limit. First off signals too close together start to interfere with one another, making it less easy for a transistor to read an on from off. Causing corruption. So make the difference between on and off larger by pushing higher voltage through. Which in turn means more electricity flowing. And that in turn means higher heat caused by resistance. And thus why these things can only be done with cooling systems such as liquid nitrogen (no air or water cooling, the heat is just way too much and would melt the metals in the CPU).
For most of the stuff these days, it’s near impossible to push further. Not without some serious cooling like pouring LN2 onto the chip.
Then also, the “entry level” stuff tends to be selected from a batch. Where the flawed chiplets on the wafer is set aside for lower performance. Due to them not meeting the tests at higher clock rates. So already an i3 is not able to stay stable at the same clocks as an i9 would. It might be a lucky silicon lottery event if you find an entry level which still tested wonderfully, but it would be an exception.
I’d be doubtful if they get many entry level stuff to read 5 GHz using just normal cooling systems. And anyway, the Hz is only a minor part of the actual speed. It’s already starting to hit a ceiling, and much greater speed increases are possible using redesign of the circuit itself, needing less cycles to complete an instruction. I.e. what’s referred to as IPC (Instructions per Cycle). Those things already show that huge improvements can be had at even lower Hz.