Originally posted by nitin kumar:
Hi
i got a problem in multithreading. In my project I have 10 threads and each thread shud run one after another ie 1,2,3,4------,10 after the completion of the 10 thread again the 1 thread shud run.For inter thread communication I know that wait and notify are one means but how to give the preference if many threads are there. Is there anything like thread priority. I will be thankful if someone provides me with code
bye
nitin
Originally posted by CL Gilbert:
I think I understand why you would say that, though in my experience I never needed it. Though I should use something.
Originally posted by CL Gilbert:
You dont need wait and interrupt. Just make a variable that is checked every loop
Originally posted by CL Gilbert:
I still highly doubt most JVMs would be violating the spec. This does not mean I am wrong. It just means I doubt it and would be speechless if it were true.
In any event, the information I gave was correct. It also seems that the information I am receiving is correct.
What I wrote is technically the proper way to write your code, but since there are violations, the things which have been pointed out to me sadly, must be respected...
Originally posted by KRISH DOSS:
a). does it mean that these variables are initialized twice when instance of the class
is created?.
Originally posted by Gerd Rosarius:
Hey,
less expensive but less effectiv: Run javac with it's optimization parameter
Example:
javac -O myClass.java
Greetings
H.-Gerd
[ February 15, 2002: Message edited by: Gerd Rosarius ]
Originally posted by Alex Zhang:
Sorry Peter, just has verbal problem! We actually want to express the same idea, may be I have wrongly caught the meanings of the words!
Pls forgive my rudeness!!! :roll: :roll:
Originally posted by Alex Zhang:
But we can hardly say that a higher priority thread must be the one being run prior than the one with low priority.
It all depends on the implementation of the thread scheduler. And it relies on the VM implementation.
Normally speaking U are absolutely correct, but there is no guarantee.
Please have a look here for details:
http://java.sun.com/docs/books/tutorial/essential/threads/priority.html
"Just remember that a thread of higher priority will always start first."
Originally posted by Horaci Macias:
Could you tell me how to see the assembler produced by a java code ?