this is two questions: list the order of the threads. i am not sure of the answer but i have included my thinking, thanks.

Thread State Priority
threadA Runnable 5
threadB Sleeping 5
threadC Sleeping 5
threadD Waiting 5
threadE Runnable 5
ANSWER: A,E,D,B,C

Thread State Priority
threadA Runnable 5
threadB Sleeping 6
threadC Sleeping 5
threadD Waiting 4
threadE Runnable 4
ANSWER: B,A,C,E,D

My thinking was start from top to bottom choose the highest priority no matter the state, then once on the same level of priority from top down select runnable first, then wait then sleeping.
thanks

Recommended Answers

All 3 Replies

Threads are controlled by the JVM.

okay, but are you saying Priority and states have no impact on how the jvm will run the threads? perhaps that is my question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.