Example Code

Safely shut down Real-Time Hypervisor system if Windows hangs

Code and Documents

Attachment

Introduction

The NI Real-Time Hypervisor is a software package that allows users to run both Windows XP and LabVIEW Real-Time simultaneously on a single PXI or Industrial Controller. In the 1.0 version of the Real-Time Hypervisor software, LabVIEW Real-Time can be rebooted any time - independently of Windows. However, if Windows XP encounters a problem or hangs, then the entire system must be rebooted together.

This example shows a way to detect that Windows has stopped responding (by checking for loss of disk access), and then have LabVIEW Real-Time automatically restart. This could be useful, for example, if a Real-Time Hypervisor user wanted to safely shut down their real-time application and restart automatically in the event of a Windows crash.

Steps to Complete

1) Open the SafelyShutDownExample project in LabVIEW 2009. You must be using a Real-Time Hypervisor system and have the LabVIEW 2009 Real-Time Module installed.

2) Download the NirSoft StartBlueScreen utility at (http://www.nirsoft.net/utils/start_blue_screen.html) and save to the c:\ directory. This utility will be used to force a Windows blue screen for testing purposes.

3) Make sure that the IP address of your real-time target it set in the LabVIEW project, and run the SafelyShutDownExample VI.

4) Run the ForceBlueScreen VI (also on your Real-Time Hypervisor controller). This will force a blue screen on Windows XP, and then the entire controller should automatically reboot. You can modify this example to perform additional operations on your real-time target prior to rebooting.

Additional Notes

WARNING - this LabVIEW project contains files that purposefully cause Windows XP to hang, and that reboot your entire controller immediately without saving files. This may cause you to lose your work, or cause the hard disk to become corrupted. In short, this example is meant to simulate a last-resort option similar to physically turning the power on and off from your Real-Time Hypervisor system in the event of a blue screen.

HypervisorReboot.PNG

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors