Heavy weight and light weight thread

后端 未结 3 1789
臣服心动
臣服心动 2020-12-25 14:29

What are the Light weight and heavy weight threads in terms of Java?

3条回答
  •  伪装坚强ぢ
    2020-12-25 14:49

    Java standard threads are reasonably heavy in comparison to Erlang threads which are very light spawnable processes. Erlang demonstrates a distributed finite state machine. However as an example, http://kilim.malhar.net/ , a Java extension library based on the Actor model of concurrency, proposes a construct for light weight threads in java. Instead of Thread implementing run(), a Kilim thread implements from the Kilim library using an execute() method. Apparently it shows Java's runtime outperforms Erlang's (atleast in a local environment AFAIK). Java did actually have such things in the original language spec called 'green threads' but subsequent Java versions dropped them in favor of native threads

提交回复
热议问题