Use cron queues to store stuff that needs processing later on cron. This post provides a cron queue system to handle jobs in the background.
An overview of the possible options when trying to perform heavy batch data operation on cron run (Drupal 6)
http://svendecabooter.be/blog/performing-batch-data-operations-on-cron-r...