>>>>> Peter Kovacs writes:
Peter> First of all. JDK 1.2pre for Linux is great. Congratulation
Peter> and thanx to the people who brought it together. Q:
Peter> 1.) (JDK 1.2) Setting different priorities does not seem to
Peter> have an effect on thread scheduling (a thread with priority
Peter> reduced to mininum will continue to get scheduled as
Peter> frequently as higher priority threads) -- even when using
Peter> native threads (unlike on Windows NT or Solaris). Why? As
Peter> far as know, native threads under linux use cloned
Peter> processes. If this is true, the JVM could set the priority
Peter> of the op. sys. processes accordingly to what is requested
Peter> in the Java byte code being interpreted. Would not is solve
Peter> this deficiency of the Linux impl.?
We use LinuxThreads with the SCHED_OTHER scheduling policy,
SCHED_OTHER always uses priority 0. The other two scheduling polices
(SCHED_RR, SCHED_FIFO) are available only to processes with superuser
privileges. Even if we would work on the 'processes' itself, only the
superuser would be able to raise a process' priority.
Peter> 2.) (JDK 1.1.7) Green threads do not seem to yield
Peter> execution to other threads until explicitely asked
Peter> (yield()), or getting blocked on IO or sleep(). If green
Peter> threads are user threads in the same process, how did you
Peter> achieved the mentionned behavior? (To my knowledge, when
Peter> you call sleep() or block on IO, the whole process will get
Peter> blocked with all the user threads.)
You simply don't use blocking IO with green threads, i.e. blocking
io in java is implemented through non-blocking io in green threads
implementations.
Peter> 3.) (Slightly OT) Earlier in this group, thread issues has
Peter> been discussed and someone mentionned that the JVM spec
Peter> does not even require that the JVM schedule another thread
Peter> when the current thread calls yield(). Not requiring to
Peter> provide a reasonable (automatic) scheduling policy (each
Peter> thread gets scheduled to execute according to its priority
Peter> on a best effort basis) is, in my opinion, bad enough. Do
Peter> not you think that, on top of this, not being able to rely
Peter> on the JVM providing the minimal facility to control thread
Peter> scheduling from the application through calling yield()
Peter> makes threads useless? (...if you want to write portable
Peter> code, which I think is one of the raisons d'etre of JAVA.)
The best thing is to write code that doesn't depend on a specific
scheduling policy.
Juergen
--
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]