Your program is obeying thread rule
processor executes one instrution at a time
it runs the program and now it depends upon OS how much clock cycles it give to
a program ( thread)
Try increasing the loop
you will see output like
some "x" then some "test" then some "x" then some "test" ..............