Hello everyone,
If I am using two threads, the task of one thread is to read the first 1k bytes from a specific file and the task of second thread is to write (maybe modify without the change of 1k length, maybe append some additional bytes making the file larger, maybe remove some bytes making the file smaller) the last 1k bytes from the same specific file (the first 1k bytes and the last 1k bytes are not overlapped), need I add lock to the two threads so that they will work in a synchronized approach?
I think even though the two threads are operating the same file, but they are accessing (read/write) different parts, there is no need to add lock to the two threads to force them to work in a synchronized approach. Just let the two threads free to run in a simultaneous approach. Am I correct?
regards,
George