fix up dead lock detection.

pid_alive return value needs to be checked.
introduce get_writable_address
remove unused within_page function
remove unused validate_address function