Hi,

In message "Re: Threads creating threads creating threads..."
    on 02/04/21, Jean-Hugues ROBERT <jean_hugues_robert / yahoo.com> writes:

|>Ruby's thread implementation isn't the best.  It is slow since
|>switching threads involves physically copying the stack memory.
|
|Very surprising ?! I once implemented a portable thread library. Using 
|setjmp()/longjmp() too. However I implemented thread stacks in the global 
|process stack, using a rather difficult to follow state automata, recursive 
|calls and setjmp()/longjmp() to control the program flow.
|
|Result was that the process's stack was fragmented into small chunks. 
|Thread switching involved setjmp()/longjmp() only, no copying at all. Was 
|much faster than native threads... but non-preemptive and not taking any 
|advantages of multiprocessor architectures.

Hmm, I thought this behavior requires the knowledge about internal of
jmp_buf structure.   I'm very interested in how it works.  Could you
show me the source, please?

							matz.