All~

I have a naive question:

Why must each thread have its own interpreter?


I understand that this suggestion will likely be disregarded because of the answer to the above question. But here goes anyway...


Why not have the threads that share everything share interpreters. We can have these threads be within the a single interpreter thus eliminating the need for complicated GC locking and resource sharing complexity. Because all of these threads will be one kernel level thread, they will not actually run concurrently and there will be no need to lock them. We will have to implement a rudimentary scheduler in the interpreter, but I don't think that is actually that hard.

Threads that do not share state, can be implemented as seperate interpreters that send events to eachothers to synchronize.

This allows threads to have completely shared state, at the cost of not being quite as efficient on SMP (they might be more efficient on single processors as there are fewer kernel traps necessary).

Programs that want to run faster on an SMP will use threads without shared that use events to communicate. (which probably provides better performance, as there will be fewer faults to main memory because of cache misses and shared data).


I understand if this suggestion is dismissed for violating the rules, but I would like an answer to the question simply because I do not know the answer.


Thanks,
Matt



Reply via email to