Computer memory hardware architecture
CPU, A modern computer has two or more CPU, Some of them CPU And multi-core , You can see that , There are two or more in one CPU On modern computers , It's very possible to run multiple threads at the same time , And each CPU At some point , There is no problem running a thread , It means , If Java Programs are multithreaded , stay Java In the program , Every CPU The last thread may be executed concurrently .
CPU Refisters（ register ）, Every CPU All contain a series of registers , They are CPU The foundation of memory ,CPU The speed of operation in register is much faster than that in main memory , This is because CPU The speed of accessing register is much faster than main memory .
Cache（ Cache ）, Because there is a gap of several orders of magnitude between the computer's storage device and the processor's computing speed , The speed of modern computer has to be as close as possible to the speed of a buffer processor between read and write , Copies the data that the operation needs to use into the cache , So that the calculation can be carried out quickly , When the operation is over , In synchronization from cache to memory . So the processor doesn't have to wait for slow memory reads and writes ,CPU The speed of accessing cache layer is faster than that of accessing main memory , But it's usually slower than accessing internal registers .
Main Memory（ Main memory ）, Random access memory （random access memory,RAM） Also known as “ Ram ", A computer contains a main memory , be-all CPU Can access main memory , Main memory is usually better than CPU The cache in is much larger .
JVM And computers
JVM And Computer Memory architecture differences , Hardware memory does not distinguish between stack and heap , For hardware , All stacks and heaps are distributed in main memory , It may appear in the cache 、 In the register .
Memory model abstract structure