One of the first function which gets executed when magento starts up is Mage::run()
this function further calls ‘core/app’ run() function
In this function there is a function $this->_baseInit(). baseinit() function is responsible for reading all configuration files in app/etc/ folder, so basically in this function local.xml configuration is read.
Next the function loadModules() is called.
This function is divided in two parts
_loadDeclaredModules(): this function reads all modules from app/etc/modules/ folder and sorts them according to ‘depends’ tag.
_loadModulesConfiguration(): this reads the config.xml file for each module and this is where magento checks for active modules and doesn’t load config.xml file
So Mage_Core_Model_Config is class where we can find all code related to this