PowerShell 7 introduced a much needed feature for running pipeline input in parallel.
The documentation for PowerShell 7 does not provide any detail on how this is implemented.
Having leveraged PoshRSJob
and Invoke-Parallel
modules before, I'm aware that runspaces were traditionally considered the much more efficient approach for parallel operations in powershell over running PowerShell jobs. I've read some mixed content indicating that this is using threading now and not runspaces, but can't find anything else specific.
I'd really appreciate some technical insight into:
- What is the lifecycle of an execution from a .NET perspective
- Is the new functionality runspaces or threads? (or is a runspace just a .NET thread in System.Management.Automation?)
- Does this bring about any complexity in traditional debugging now that we are moving into parallel operations? Historically I had a rough time debugging with runspaces, and not sure what options might have been improved
$Using:
]. it loads all the needed modules and functions and whatnot into each runspace, so it takes time to set up & tear down. i have not seen anything about debugging so far. – BurschenschaftPSTaskPool
). The RFC goes into some detail about implementation and constraints. The source code also contains a number of helpful comments – Grobe