java - Why do multiple threads access the same resource?
PHP中文网
PHP中文网 2017-06-12 09:27:45
0
2
1065

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?

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
扔个三星炸死你

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!!!!!!

淡淡烟草味

Because it has multi-core CPU

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template