Watchdog, Watchdog

Source: Internet
Author: User

Watchdog, Watchdog

I. Introduction

Watchdog is mainly used to monitor the running of the system. the Linux Kernel not only provides drivers for various types of watchdog hardware circuits, but also provides a timer-based pure software watchdog driver. The driver source code is located in the drivers \ char \ watchdog \ directory of the kernel source code tree.

 

Ii. Principles

The kernel watchdog module communicates with the user space through the/dev/watchdog character device. Once the/dev/watchdog device is enabled for a user space program, a one-minute timer is enabled in the kernel, the user space program needs to ensure that data is written to the device within one minute, and each write operation will cause the timer to be reset. If the user space program does not perform write operations within one minute, the expiration of the timer will cause a system reboot operation. The user space program can stop the timer in the kernel by disabling/dev/watchdog. In the user space, there is also a daemon called watchdog, which can regularly detect the system. If a detection fails, this may cause a soft reboot (simulating the execution of a shutdown command). You can also use/dev/watchdog to trigger the running of the kernel watchdog.

 

Iii. Differences and connections

1) Hardware watchdog provides better reliability

The hardware watchdog must have hardware circuit support. The device node/dev/watchdog corresponds to the real physical device. Different types of hardware watchdog devices are managed by the corresponding hardware driver. The software watchdog is implemented by a kernel module softdog. ko through the timer mechanism./dev/watchdog does not correspond to real physical devices, but provides an interface that is the same as the operating hardware watchdog. The software watchdog is implemented based on the kernel timer. When the kernel or interrupt encounters an exception, the Software watchdog will become invalid. The hardware watchdog is controlled by its own hardware circuit and is independent of the kernel. Regardless of the current system status, the hardware watchdog will restart the system if it is not written at the specified interval.

2) more complete hardware watchdog functions

Some Hardware watchdog cards such as WDT501P and some Berkshire cards can also monitor system temperature and provide/dev/temperature interfaces. For applications, the methods for operating software and hardware watchdog are basically the same: Enable the device/dev/watchdog and perform write operations on/dev/watchdog during the restart interval. That is, the software and hardware watchdog are basically transparent to applications.

3) in addition

At any time, only one watchdog driver module can be loaded to manage/dev/watchdog device nodes. If the system does not have a Hardware watchdog Circuit, you can load the Software watchdog driver softdog. ko.

 

Iv. Test

http://sunnyshineboy.blog.163.com/blog/static/2028151182012539552151/

 

V. Source Code

http://www.oschina.net/news/8002/linux-watchdog-5.8-released

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.