0

When I write in JenkinsFile something like this:

node {
   parallel (
     phase1: { sh "./firstProgram" },
     phase2: { sh "./secondProgram" }
   )
}

does jenkins run it as different processes or just only as different threads?

1 Answer 1

1

The workflow-cps plugin is what provides the parallel functionality. Below is an excerpt from the plugin's page which discusses how parallel works.

All program logic is run inside a “CPS VM thread”, which is just a Java thread pool that can run binary methods and figure out which continuation to do next. The parallel step uses “green threads” (also known as cooperative multitasking): it records logical thread (~ branch) names for various actions, but does not literally run them simultaneously. The program may seem to perform tasks concurrently, but only because most steps run asynchronously, while the VM thread is idle, and they may overlap in time. No Java thread is consumed except during the typically brief intervals when Groovy code is actually being run on the VM thread. The executor widget only displays an entry for the “flyweight” executor on the built-in node when the VM thread is busy; normally it is hidden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.