So the STB is dual core. I thought we can only create 2 proper threads.
In every keyreleased()
I am creating a new thread
Runnable runnable = new Runnable()
{
int i = j;
public void run()
{
while (true)
{
System.out.println("This thread is running always number is " + i);
}
}
};
Thread th = new Thread(runnable);
th.setPriority(Thread.MAX_PRIORITY);
th.start();
j++;
//...
}
But even after creating 20 more threads, box doesn't have any issues.
Is it because JVM realized that the run block is empty and it optimized the code ? Or is the JVM implementation for while(true) is different ?
Note: i have tried putting Thread.sleep(1000) as well but no problems