To process very large data is very much time-consuming, it may lead to PHP timeout error. To process very large data, Drupal offers a batch API. The Batch API allows you to run one or more operations on a large set of data without timeout and feedback on the progress of the operation.
Advantage of Batch API:
Avoid PHP timeout.
Display the progress of the process.
Avoid out of memory situations.
Let's look a simple example in Drupal 6 that use batch API: