Actually, gaurds who are put in with inmates like that have normally befriended several inmates. In the event something like this is to happen, those inmates will step in and put a stop to it. The inmates that keep good behavior and prevent fights from breaking out are normally given special privileges (cigarets, better food, less time sitting in their cell). Some inmates are even promised to get out a little bit early if they help keep order around the area (provided the said crime they did was not too bad).