I've used 3 methods to deal with caged hostiles:
- Mass pitting (see wiki). I've basically stopped using that method because the captives sometimes escape when pitted, and when that happens, the whole lot seems to escape (i.e. 8 cages around a locked hatch, if the first one escapes the other ones seem to escape when the time for their pitting comes along, when all 8 pitting jobs are ordered at the same time). This method has the advantage that magma under the hatch eliminates the unsightly bodies and the associated negative thoughts (except for the mess caused when pittees escape). Since pitting is a civilian job, escapes frequently result in civilian injuries, even when the militia is stationed there.
- One-by-one execution through execution squad. Build the cage beside the sapient refuse (quantum) stockpile. Hook it up to a lever outside the room, station the militia there, pull the lever, release the militia from the station order, let the dorfs clean up the mess, hook up the next cage... Trains the militia, and allows your bone carver and bowyer to produce ¤elf bone greaves¤ and ¤goblin bone crossbow¤, but results in stress from all the corpse hauling (I've just had to send my engraver on work therapy due to stress from cleaning up the mess).
- One-by-one execution through atom smashing. Hook up a cage as per the above, but build a 1*10 raising drawbridge in a dead end corridor with two tiles remaining at the end. Build the cage at the end (it and the gear will end up either on the cage tile or the one beside it). Place a door outside of the drawbridge. Pull the lever and lock the door as the victim moves towards it (and thus on top of the bridge) and activate the drawbridge. That usually hurts the victim. Lower the drawbridge to atom smash the victim. This setup can also be used with a pressure plate to automate the smashing, but you then need a manual bridge control as well for the case when the victim decides to stop on the pressure plate (and thus keep the bridge up). Also note that big creatures (undead blind cave ogres among them, I've found. I haven't tried it with living ones, nor with "normal" ogres) are too large to allow the bridge to raise (and destroy it if it tries to smash them).