i=1 Thread.start{ while true print "Thread 1 " i+=1 if i==5 then Thread.kill Thread.current end end } j=1 while true print "Thread 2 " j+=1 if j==4 then Thread.exit end end