In some cases, as with your grandad, doctors may decide that there should be no attempt to resuscitate a person if they have a cardiac arrest or stop breathing. This is called a DNACPR (do not attempt ...
And that's for a typically healthy businessman who collapses on the subway platform from a heart attack, not for someone dying ... and doctors do to help people die quiet deaths at home.