Hello, I am not having more information about the Thread scheduling in java, but I am having the code below which will help you to get knowledge about it.
Code:
public class ThreadTest
{
public static void main(String[] args)
{
int Total = Integer.parseInt(args[0]);
long Num = Long.parseLong(args[1]);
Thread thread[] = new Thread[Total];
for (int i = 0; i < t.length; i++)
{
thread[i] = new Thread(new Task(Num, "Task " + i));
thread[i].start( );
}
for (int i = 0; i < t.length; i++)
{
try
{
thread[i].join( );
}
catch (InterruptedException ie)
{
}
}
}
}
Bookmarks