Windows XP is bad for doing this. Doesn't happen that often on Windows 7 unless a program has crashed. Programs that do that tend to be 3rd party badly written programs.
Most cases that I see is either the above, a badly written driver or 7 is just not setup correctly.
Have two server boxes here one with Windows 7 which has been up and running a few months now without needing a restart.
The other is Server 2008 R2 which is solid a rock (can even disable the gui if you wish)
Windows 8 doesn't seem to suffer from it, I've been running it for over year now. The only thing I dislike is the new task manager (But wont get into that).
Linux, now here's an OS that I can't kill. Had one server running for years without needing to reboot it and that's using x windows not just the shell.