need help to write script to check the process health and automatically restart it

I am working on a project, which need to constantly watch the process, and check its status, if it was dead, it should be restart automatically.
Please kindly refer me to URL which teach how to write this kind of script, or service.
Thanks.

See the keep alive script in the frequently asked questions section.