OS X restarts every app when waking up

Solution 1:

I presume you're talking about Resume, a feature that will cause apps that were left open when you logged out to open again when you login.

From your explanation, I presume you see a window of an app, but then it will fade out and appear to 'restart' — in actuality the app hasn't loaded once yet, and is loading, not restarting.

You can stop Resume by unchecking the Reopen windows when logging back in option in a log out or shutdown dialog.

Solution 2:

At last I've found the solution.

When I was watching a movie I saw that message "Are you sure you want to quit all applications and log out now?" It was all about a "Security and Privacy" preference that quits all application and logout. I found the solution on Apple Support Communities. Here is the solution:

Open the "System Preferences". In the "Security and Privacy" preference pane click the "Advanced..." button and uncheck "Logout after XX minutes of inactivity".