DWM.exe is "Desktop Window Manager". This is responsible for the graphical effects such as live window previews and a glass-like frame around windows (Aero Glass), without draining your CPU. A DWM-capable graphics card is required to enable the 3D effects, as well as Aero Glass.
The Aero and 3D effects are mostly rendered using a 3D method (instead of 2D) and uses your grafics cards 3D render processing capability. The item is a windows Service. This is also the service that gets shut-off (temporarily) when a 3D game (or other) is using the GPU so much that the DWM turns off those functions, leaving you with "basic" desktop mode.
If it is failing at some time when running a game, it probably has itself to blame, although doing a >SFC /Scannow on the system to check all aspects of the operating system integrity would be good. Could be it is failing to do the notify you then disable, or re-enable, as it is designed to.
I do not think there would be any easy way to seperate the 2 in the way your suggesting, because they are not together :-) they are just trying to use the same resources, so when one hogs all the resources the other one fails. Remember in the newer OSes (8+) they just tossed some aspects of this out, probably because of some of the issues people are having with it.
It is not a requirement to keep the service running, the system is designed to take care of that, and asks the user what to do. You could disable the service.
Things I am not sure about, you could manuel the service and start and stop it at a whim, or setup a batch to stop it, run your game, and restart it on the way out.
My own method is to have "theme" switches, batch theme changer that switches from Aero to classic themes, I can switch to the classic theme with a shortcut button, before playing a game, switch it back after not needing the GPU so much anymore. It would not have to switch to classic (my own choice) but to a theme that is classed as "basic" which dumps all the GPU effort stuff for the desktop.
Conclusion: Best way to restrict it from messing up what your doing, toss it out :-) disable the service, use a basic or classic theme, or temporarily stop it while playing.
Other things: If it isnt critical to your gameplay, you may find that having V-sync turned on in either a game or in the GPUs software options would also help, because then your only rendering a frame for each frame you actually see, thus allowing your GPU to relax a bit :-) Or restricting the frame rates in the game (some games) to the maximum that your monitor can actually display.
While Windows 8 doesn’t have Aero Glass, it still has the DWM. It’s here to stay. – Daniel B – 2015-06-27T21:36:51.640
Yea please edit anything you see that needs it, me being "delete first" my first win7 system I just disabled all that entirely, and I am only now learning to cope with aero. – Psycogeek – 2015-06-27T21:45:03.177
For now my PC doesn't freeze, when aero is disabled during the game's runtime. I didn't enable V-sync, because I don't like this option enabled (but this is more subjective). Thank you very much :) – Cubi73 – 2015-06-28T13:25:35.750