Handling long-running background tasks in Drupal 7

If you have a task that must occur regularly, but will take a long amount of time to complete, the cron queue might be a good solution. For instance, if you have a lot of nodes that need to stay synchronized with a remote dataset, you might want to synchronize a large portion of them during a cron run, but would like your other cron tasks to complete in a timely manner.

Drupal provides an easy interface to adding such long-running background tasks via hook_cron_queue_info() and hook_cron().