New to the world of parallel computation. Would it be correct to say that CPU's are actually
thread calculators? My understanding currently: a
process is composed of multiple
threads and a single core on a cpu is capable of executing instructions from 1
thread at a time, sometimes a bit more when taking into account hyper-threading, but essentially it is computing threads. When the CPU, along with all of its cores, are done calculating all of the
threads that belong to a specific
process then that
process would be considered complete.
So like an analogy would be:
A CPU is like a monkey, with N number of mouths (cores). Each mouth is responsable for eating a long chain of bananas (threads) out of wooden crates (processes). We can increase the rate at which some program is finished/emptied, by hooking up more banana chains from it to an empty and waiting core/mouth. A program is called complete if the wooden crate is emptied of all bananas.
Would this interpretation be correct?
also what are some of the practical differences (programming-wise) of what I can/cannot do with spawning new processes vs threads. I always see something along the lines of
processes have their own memory while
threads share it but what do they really mean by that? Like in python, can I just go like
from thread_a import var_something?