Runmodes are helpful if you have different configuration for different environment. Suppose you have a DEV, UAT and PROD environment and you site has a database connection. It is obvious that you will have different database configuration for each environment. So, you commit the separate configuration for each environment in specific run modes. For example, for the dev environment, you commit the configuration in config.author.dev, config.publish.dev folder. In the same fashion, you commit the config for UAT and PROD environment so that AEM pick the configuration from the folder in which run mode aem is running.
Here are some links for better understanding
In your project you have OSGi services and you different environment (eg LOCAL/DEV/QA/STAGE/UAT/PROD) for AEM Author and Publish. Now suppose you want different configuration values for each environment then in that case you can create run mode like
and put xml file under these folder.
There are two types of run modes.
1. Primary Run mode
2. Secondary or Customized Run mode.
Primary Run mode:
Primary run modes used at the time of installation and are fixed for the entire lifetime of that installation. There are two primary run modes provided from adobe author and publish.
Here we cannot change primary run mode after installation, as crx-quickstart folder is created after first installation according to run mode.
Secondary Run mode:
Secondary or Customized run modes are applied on each startup and can be changed with a restart of AEM instance. These are custom run modes defined for specific environment like development (config.author.dev), Testing(config.author.qa) or production(config.author.prod) as said by Rajeev and codingStar.
How to Implement: See this article and you will known clearly.
Hope this helps!!
what is create run modes about in this above link is it third method or it is another method to set up run modes in secondary run modes?