There are a couple different types of boat locks. Some are on propellers, some on engines, and some one trailers. They are designed to keep anyone from stealing all or part of the boat. Most common have a locking bar used on the engines. There are also flush locks and anchor locks. It all depends on particular area or use.
A boat lock is a thing that lock a boat.
A boat has to wait in a lock for the water to be the right level in a lock.
A lock. A lock raises and lowers a boat to the level of water in the next lock.
A lock raises and lowers the boat to the level of the water in the next lock.
you dont
boat
Commercial boats
This is assuming you have to fill or empty the lock you have approached. The water-level has stabilised at the same in both lock and canal in the approach. In fact on manually-operated locks at least, you would not be able to open the gates until the levels are practically the same. And of course, if there is a boat waiting to leave the lock you wish to enter, you give it room to manoeuvre. If the gates are is open in your favour and there is no boat on its way out, then you simply take your boat straight in.
barge :)
Military, commercial, fishing then personal
Lochs and dams, a system in which an enclosed lock is filled with water to raise a boat so that it may go upriver past obstructions.
Generally, the boat approaching the lock at the same water level as is in the lock, has priority. All things being equal commercial takes priority over pleasure craft.