how drupal decide execution order of same hook in different modules? if there is two modules A and B and both have same user_login hook. so when i log in. out of A_user_login() and B_user_login() function which one called first.and how drupal decide
execution order of these two function
Hooks are called in order of


Weight, which is defined per module in the database as {system.weight}.  Lower weights come earlier in the calling process.
Alphabetical, by module name.


By default, modules get assigned a weight of 0, so nearly all hooks in the system run in alphabetical order.  Some modules will adjust this in their install hooks so they run earlier or later in the module_invoke_all function.

See also: Adjusting module weight: what are the risks and things to look out for?