what is memory model
From Wiki[3], the memory model is defined as follows:
In computing, a memory model describes the interactions of threads through memory and their shared use of the data.
The context is multi-thread, which is sth about concurrency/synchronization.
At the time when a computer only has one core/cpu, memory is owned by the single thread, in which instructions has a well-defined order. As time goes by, we have multi-cpus/multi-cores-one-cpu allowing us to executing more than one thread at the same time.The problem is that we only have one memory, and the set of threads are always cooperating with each other to cope with a whole task instead of being independent.They need communication(known as IPC: inter-process communicaiton), which have two methods:
- share memory
- message passing
The latter is used in the network/distributed system, we will leave it aside.The formmer defines a n-to-1 model, which we need to deal with the logic of the program - the execution order of threads happening at the same time.That’s when we need the memory model: