Multiple jobs reading from same file

I have a sequence of tasks that I routinely run and I'm trying to parallelize certain portions of the sequence. Specifically, there are 3 tasks which all read from the same file, each performing different operations and writing to their own seperate file. I was wondering if I could execute these three steps at the same time.

Side note: I didn't write the code for these steps, so I can't just wrap them all up into one or anything like that.

You can run jobs in the background. If you have the tasks

  • in separate scripts:
./script1 &
./script2 &
  • as functions in a script:
your_function1 &
your_function2 &

Thanks, Franklin52, that's precisely what I had in mind, but what I was actually getting at was the safety of this technique.

I know that multiple processes writing to the same file is a recipe for trouble, understandably, but I was curious whether multiple jobs/processes reading from the same file is also dangerous.

For example, what happens if they both try to read the same block of memory at the same time?

My googling turned up some forum topics about this in C code, where it did seem to be an issue, but I was going to submit jobs to the background like in Franklin52's post. Can I rely on the OS to sort out any conflicts between the processes?

It shouldn't be a problem IMHO to read a file with 3 processes simultaneously.