XP automatically restarts when it encounters a serious "System Error." However, it is often better to stop this action and recieve a blue screen error with a STOP message (sometimes called a "Blue Screen of Death" or BSOD) than to not know why your computer is restarting. If you do get a STOP error, write down the 0x00000024 or whatever your particular one is along with any drivers that may be named (usually end with a .sys). Then, post a detailed explanation on a tech support forum and patiently wait.
1. Right-click My Computer and click "Properties"

2. Go to the Advanced tab

3. Click the "Settings" button under Startup and Recovery

4. Under System Failure, uncheck "Automatically restart"

5. Click OK for each window
6. Save all you unsaved changes, close all windows, and restart your computer.