0

Lets say I have a block of code like this:

while condition; do
  {
   command 1
   command 2
   command 3
  }
done

Does pushing the block of code between the curly braces to background like this { code } & results in parallelization. Is there any improvement in performance by doing this for CPU intensive code blocks.

Newstein
  • 141
  • 8
  • It allows the entire group of commands to run in the background, but the 3 as a group will still be sequential. Your example is missing the `&`. – jordanm Nov 06 '17 at 06:47
  • I get that the 3 commands will be sequential. My doubt is whether pushing a cpu intensive block of code result in any performance improvisation. Say, will a while loop running 100 times taking 1 sec per loop complete in 1 sec instead of normal 100 sec. – Newstein Nov 06 '17 at 06:55
  • @Newstein: You mean you want to run each loop instance in parallel? i.e. 100 parallel instances – Inian Nov 06 '17 at 06:58
  • Yes. If that is possible. – Newstein Nov 06 '17 at 07:00

0 Answers0