That old thread that was linked above had problems, namely an inability to identity the
actual problem.
If your players are randomly killing innocents, you shouldn't be playing with them. It's not a problem with the GM, with communication, with setting expectations, with heavy combat vs light non-combat rules, but just having bad players. Of course, this is
rare but it seems to come up in threads like this all the time.
The old thread had some good discussion anyway, but the original example was ridiculous and not indicative of the problem. Too much discussion revolved around crazy PCs and not solving the far more common issue.
In
this thread the DM came up with a great solution to an overly violent PC... but they identified the problem being a metagaming player out for XP.
If the players are using violence as the solution to most or all
problems, then it's worth talking to them about the issues. You might even find they won't enjoy the games you run and need to find new players.
I'm actually seeing a lot of bad advice in this thread. "Pick a different game, make it a puzzle game, etc." That's a great way of having unmotivated players who might just abandon the setting and go find monsters to kill (and this is assuming they're not players who should just be ditched).
I've learned through hard experience that often I need good-aligned NPCs rather than monsters for dealing with PCs who occasionally go crazy. (Dark Sun is great for that; templars are scary, and these are
evil cops so expect torture, robbery, etc. Even if you can bribe your way out of jail, since the templars are corrupt, you just lost a chunk of change.) However, generally the threat is enough; if I found I had to bust out templars in order to keep PCs from randomly killing bartenders, I'd dump those players and find new ones.