If you’re using Windows, there’s a ‘watchdog timer’ on the display driver that resets the card if you have any kernels that run for too long. You can reset it or disable it if you want, but Microsoft forbids any of their licensed developers from changing that to make their software work (so it’s fine to do on your own machine, but not if you’re selling it). In any case, if you change the timer (or disable it), the screen will probably freeze while it’s working, so you won’t have a way to tell if it’s hung up for real.
I believe that the window manager in Linux has a similar function as well, but if you run command-line only, you can execute kernels for as long as you’d like.
EDIT: You probably want to break your kernel up into small chunks that can run in under the required time; if you’re going to be distributing the code as part of a program, make sure you test it on multiple devices (a kernel with X amount of data will execute faster on a GTX 280 than it will on an 8400M GS, for example).