I have a little confusion about the way threads works on a NT platform. According to the JDK documentation NT runs time slicing to schedule threads. This would mean that if I put two threads to the running state, eventually they will run, but there will not be any specific order to which will run. I mean if I have this two lines in my code:
myThread1.start();(run will call this line System.out.println("Thread1"); three times)
myThread2.start();()();(run will call this line System.out.println("Thread2"); three times)
I would spect that from the point of view of HUMANS my main thread, and the other two together will run in parallel. I know that they in the real life will run sequencially, but the effect you get on human is that
they are running at the same time. Thus, if I execute a piece of code where I have these two lines I would spect that the output to the console would be print the words Thread1 and Thread2 without any specific order, but when I execute this code I get the output of the first thread and then, following, the output for the second thread. It is like the system is running them sequencially one after the other and not in parallel using time slicing.
Could anybody explain me????
Thanks in advance.