Using semaphores instead of locks to ensure safety in loading and setting up the stack.