Multhithreading z and m step