multithreaded application with flocking algorithm