What's compute ?
Instructions
Quadcore processor
Disclaimer: To simplify things, we are ignoring hyperthreading for now
USER THREADS - NOT AN OPERATING SYSTEM LEVEL CONCEPT
BUT MOVING ON JAVA USES KERNEL THREADS 1:1 MAPPING TO OS LEVEL THREAD
https://claude.ai/chat/4683cb85-b412-4691-893a-1b7f9c2b05b7
Concurrency vs Parallelism
Bookish def
Concurrency: managing multiple instruction sequences at the same time
Parallellism: running multiple instruction sequences at the same time
Concurrent: Tasks are making progress during overlapping time periods, but they're taking turns using the CPU
Parallel: Tasks are literally running at the same exact moment on different CPU cores
More
class Main {
public void spawnFourThreads() {
Thread t1 = new Thread(() -> {
// operation 1});
Thread t2 = new Thread(() -> {
// operation 2});
Thread t3 = new Thread(() -> {
// operation 3});
Thread t4 = new Thread(() -> {
// operation 4});
t1.start();
t2.start();
t3.start();
t4.start();
}
}Assumption - 4 core machine, single process, spawns 4 threads
M - Modified
E - Exclusive
S - Shared
I - invalid
Cores maintain cache coherence
By following the MESI protocol
False Sharing