Hello,

Recently I exchanged information about user threads with Ruby
community in Japan.

The user threads of Ruby 1.8 are heavy weight and Ruby 1.9 switched to
kernel threads. The reason why user threads of Ruby 1.8 are heavy
weight is *portability*. Since Ruby community does not want to prepare
assembler to change stack pointers for each supported CPU
architecture, Ruby 1.8 copies the stack of user threads on context
switch.

Because I need to explain why the user threads of GHC are light
weight, I gave a look at GHC's source code and found the
loadThreadState function in compiler/codeGen/StgCmmForeign.hs. In this
function, the stack pointer is changed in the Cmm level.

So, my interpretation is as follows: Since GHC has Cmm backend, it is
easy to provide assembler to change stack pointers for each supported
CPU architecture. That's why GHC can provide light weight user
threads.

Is my understanding correct?

Thanks in advance.

--Kazu

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to