i am trying to simplify problem as follows,
- i have around 100+ files that i would like to read and then process the data
- For which i maintain array of file names and location
- I spawn threads to do the job of reading files.
Now my problem is i would like to make sure that only 5 threads are spawn at a time as starting 100 + threads is not good idea at all.
So please tell me what approach i should use to ensure that the only 5 threads are working at time and as soon as even one of them is done new one can be started.
Thanks all,