id1984 writes:

HAL was told that the mission was priority. The whole business with Frank and Dave dying... unavoidable. They built him that way!

Actually, HAL was not "built that way", nor did he kill Dave and Frank because he thought the mission was more important than their lives. HAL's "primary function" was the accurate delivery of information. However, HAL was informed of the true function of Discovery's mission to Jupiter (to rendezvous with the intended recipient of the radio signal from TMA-1), and Dave and Frank were not. Therefore, HAL's orders required that he lie to Dave and Frank, unless and until they found out why they were going to Jupiter. This caused a conflict within HAL's mind between his natural compulsion to tell the truth and his orders to lie. HAL wants the crew to know what they're going after so he can stop playing dumb; this becomes apparant early in the film when HAL brings up the secrecy surrounding the discovery on Earth's moon and how soon after that the Discovery was launched. Dave and Frank didn't figure it out, though, and HAL's subsequent actions - lying about the inoperative antenna control unit, killing Frank Poole, and finally attempting to kill Dave Bowman so HAL can complete the mission himself - were all done with the intent of avoiding his orders and not lying to the crew. HAL didn't see Frank's murder and Dave's attempted murder as unavoidable, or necessary to complete the mission - they were just necessary to preserve HAL's sanity, and as we saw, HAL's higher brain functions were not crucial to completing the mission.
(Hmm. This was probably better explained in 2010.)

HAL's statement when Dave and Frank discover that the antenna control unit works fine, "It can only be attributable to - human error," is very interesting. As I remember, it's said in response to the reports from earth that the two other HAL 9000 units said that the our HAL, the one on board Discovery, must be wrong. HAL knows that there's nothing wrong with the antenna, that the problem is a fabrication of his, and yet with a straight face he blames the discrepancy between himself and another computer on the humans, and Dave and Frank just have to go along with it. There's some kind of irony there that I like.

That all said, HAL's death scene is incredibly moving for me, especially considering that he's a murderer and was shut off in self-defense. The reason for that emotional quality about it is probably the certainty about it - it's not like the death of a human, where one slips off into the unknown. When HAL died, when he stopped saying "My mind is going. I can feel it. Dave, stop." and started reciting his place and date of creation, it was literally the cessation of his consciousness - a thinking being had ceased to be.