As the title states, multi-threading is essentially a reasonable scheduling and allocation of CPU time slices to achieve seemingly concurrency, but in fact only one instruction is executed at a time. Why do multiple threads access a resource?
扔个三星炸死你2017-06-12 09:29:45
Because an operation on a resource may be composed of multiple instructions. Only when these multiple instructions are executed, the operation on the resource will be completed. If you have not finished executing these instructions, switch to other threads. Macroscopically speaking There will be situations where multiple threads access the same resource
And, who said that there is actually only one instruction executed at a moment? Who says multi-threading is only about apparent concurrency? Don’t you know the existence of Multi-core CPU
!!!!!!