Wednesday, 4 March 2009

Dalla GreenThreads al NativeThreads

Does it make sense to talk about the Java threading model? Java, is of course, a naturally multi-threaded languages, but the threading model is mandated NOT by the spec but by the VM implementation, surely? In particular, what is the relationship between the Solaris threading model and the Java threading model?

threadingmodel( _Java, 1.1, GreenThreads). ? GreenThreads = simulatedThreadsInVm.
threadingmodel( _Java, 1.2, NativeThreads).

advantage( GreenThreads, _Linux, time(X), reason(Y)). ? X = earlyDaysOfJava, Y = saveCost(Z), Z=spawn(A, B), A=process, B=nativeThread.

threadingmodel( _solaris, X). ? X = manytomany, X = onetoone.
alias( manytomany, (_LWP|boundthread) ), alias( onetoone, _SolarisThreads ).
has_a( _LWP, kernelthread ). schedule(kernel, task(X)) :- on_a( X, _LWP ).
too_few(LWP) :- starvation(X), thread(X).


Sun's JVM also maps 1:1 to Windows threads (not multiple processes or fibers).

No comments: