Deterrence? Probably not. Or there wouldn't be so many pedophiles out there. This creep wasn't the first pedophile to get killed in prison.
I don't know about any other country's penal system but as for the U.S., this murder doesn't surprise me at all. I've done more than a little work in the area of prisons and prisoner law suits. The one constant has been that within prisons cultures, there is NO tolerance for child molesters. The other area of total intolerance is for traitors. Seems that no matter what kind of scumbag they are, axe murderer, serial rapist, armed robber, drug dealer, etc etc, there are still some lines that can't be crossed.
And chances are it wasn't pretty either. I know of one case where one prisoner was murdered by being gutted with the razor strips from a disposable BIC razor!