On Tue, 11 May 1999 15:38:40 +0200, Nolte, Holger wrote:

>Hi, I am new at this mailinglist so I am not sure if the following question
>is still discussed.
>I am a little bit astonished about the java multithreating under linux. For
>me it looks like that the multithreading with the semantic java is much
>better. 

Well, you are just assuming that threads of equal priority will switch
between each printout in your code.

In fact, the Java spec says that threads do not have to yield unless they
are blocked by something (I/O or a monitor lock or...)

In any multi-threaded program (even non-Java) you can not assume the size
of your timeslice (as in how much work you can get done) except in what
would be a "hard realtime system" and even then things can get interesting
when you do not code in assembly (you do not know how many cycles a bit of
code is unless you know exactly what the instructions are)

As such, a large time slice or a very fast bit of code would make your
little test have the 100 lines of output per thread happen all in one
timeslice.  (Depending on the buffering in the output stream, this is
not hard to do in today's hardware)


Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to