Setting a thread's priority doesn't guarantee that the higher priority thread will run before the lower priority thread. You can read tutorials on thread priorities. Like this tutorial which says:
Rule of thumb: At any given time, the highest priority thread is running. However, this is not guaranteed. The thread scheduler may choose to run a lower priority thread to avoid starvation. For this reason, use priority only to affect scheduling policy for efficiency purposes. Do not rely on thread priority for algorithm correctness.
good one ankit - thanks, addition to above: following explanation given by simulator
In this case, the program is trying to manipulate the scheduling of thread using priorities which is a bad idea. Simply because operating systems behave differently about prioities. For ex. Win32 uses Time Slicing ie. it gives time to all the thread in proportion of their priorites but many unix systems do not let low priority threads run at all if a higher priority thread is running. So the output cannot be determined.