13. Locking Programming Interfaces One of the major features of the Galaxy platform is the ability to share resources across multiple instances of the operat- ing system. As with any shared resource, the need arises to synchronize access to that resource. The services described in this chapter provide primitives upon which a coopera- tive scheme can be created to synchronize access to shared resources within a Galaxy. A galaxy lock is a combination of a spinlock and a mu- tex. While attempting to acquire an owned galaxy lock, the thread will spin for a short period. If the lock does not be- come available during the spin, the thread will put itself into a wait state. This is different from SMP spinlocks in which the system crashes if the spin times out, behavior that is not acceptable in a galaxy. Given the nature of galaxy locks, they will reside somewhere in shared memory. That shared memory can be allocated either by the user or by the galaxy locking services. If the user allocates the memory, the locking services track only the location of the locks. If the locking services allocate the memory, it is managed on behalf of the user. Unlike other monitoring code which is only part of the MON version of execlets, the galaxy lock monitoring code is always loaded. There are several routines provided to manipulate galaxy locks. The routines do not provide anything but the basics when it comes to locking. They are a little richer than the spinlocks used to support SMP but far less than what the lock manager provides.