i am trying to understand "multi threaded step" which is one of the ways in spring batch to implement parallel processing other parallel steps and partitioning.
My question is related to reader.For example , lets assume there is a file with 1000 records ,chunk size is 100, number of threads are 4. So in this case there will be 10 chunks and each thread will be given a chunk to start and when its finished remaining chunks will be assigned to the threads and at one point of time only 4 chunks will be processed by 4 threads. But how does threads decided which data to read? Lets say if first thread is already working on 100 records , how come the second thread know that it should not pick the same records and look for records which are not picked up other threads.
In this case there will there be single instance of Reader and writer which is shared between the threads? If yes then any class level resource are not thread safe?
Thanks,