Hm. I guess I read the OPs post differently.
His task description is: read records from a (single) huge file, and write them to one of many (600) output files depending upon their contents. He asked how he could use thread to improve the performance.
You suggested splitting the huge file into several smaller files so that each thread could work on a different part.
He pointed out that would mean he would have many threads writing to each of the output files.
You are suggesting that he has many pipes and another thread running a select loop to coalesce the records for each output file before writing them.
Lets say he has split the huge file into 10 parts and he runs 10 threads. Using your schema, he would require one pipe for each of the 600 output files in each of the 10 threads; and another 600 threads running select loops to coalesce the records and write them to the 600 output files. So 610 threads and 6000 pipes!
And that's before we consider that he has exasperated the problem by reading the input from 10 separate files concurrently, which will cause the read head to be dancing all over the disk just to get the input.
In reply to Re^10: how to split huge file reading into multiple threads
by BrowserUk
in thread how to split huge file reading into multiple threads
by sagarika
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |