通常说java的是重量级线程,python,erlang等是轻量级线程,请问为什么这样说?他们的区别是什么?如何区分重量级线程和轻量级线程?
PHPz2017-04-18 10:33:16
Heavyweight threads are real threads in the operating system, and users do not have strong control over them
Lightweight threads are actually pseudo-threads. Users have more control over it, and the same is true for coroutines in golang: they are scheduled by the go language itself.
PHP中文网2017-04-18 10:33:16
Processes and threads are concepts that can be identified at the operating system level, which means that processes and threads can find corresponding IDs in the operating system. That is, heavyweight.
Coroutines are finer-grained units of work than threads.
There is also the concept of coroutine in java: http://www.blogjava.net/BlueD...