How can a module check if Drupal is showing one of the update pages? What should a module do to verify if Drupal is updating the database tables to avoid to output a message when one of the update pages are being shown (or to avoid to do any superfluous task during the update)?

The module I am referring to is a custom debugging module that does some tests at every requested page, and outputs the result using drupal_set_message().
devel.module has a function called devel_silent() that does some very comprehensive checking. I might replicate this in your own module.

function devel_silent() {
  // isset($_GET['q']) is needed when calling the front page. q is not set.
  // Don't interfere with private files/images.
  return
    function_exists('drupal_is_cli') &amp;&amp; drupal_is_cli() ||
    (isset($_SERVER['HTTP_USER_AGENT']) &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'ApacheBench') !== FALSE) ||
    !empty($_REQUEST['XDEBUG_PROFILE']) ||
    isset($GLOBALS['devel_shutdown']) ||
    strstr($_SERVER['PHP_SELF'], 'update.php') ||
    (isset($_GET['q']) &amp;&amp; (
      in_array($_GET['q'], array( 'admin/content/node-settings/rebuild')) ||
      substr($_GET['q'], 0, strlen('system/files')) == 'system/files' ||
      substr($_GET['q'], 0, strlen('batch')) == 'batch' ||
      substr($_GET['q'], 0, strlen('file/ajax')) == 'file/ajax')
    );
}


You can probably simplify this a bit to just the part that is checking for 'update.php' and the $_GET['q'] checking.

    strstr($_SERVER['PHP_SELF'], 'update.php') ||
    (isset($_GET['q']) &amp;&amp; (
      in_array($_GET['q'], array( 'admin/content/node-settings/rebuild')) ||
      substr($_GET['q'], 0, strlen('system/files')) == 'system/files' ||
      substr($_GET['q'], 0, strlen('batch')) == 'batch' ||
      substr($_GET['q'], 0, strlen('file/ajax')) == 'file/ajax')
    );