He must have realised there was a good chance he would get shot anyway during his spree - so his mentality is akin to a suicide bomber. Hence death penalty is no deterrant. Stopping the brain washing that leads to the suicide bomber mentality is the only, or main, practical answer.