Which is the best way of implementing threads and why?