All balls are forced to locate on a grid. This grid is defined as lists of x and y. And a semaphore is used for access control of the list.