concept activity in category powershell

This is an excerpt from Manning's book Windows PowerShell in Action, Third Edition.
Chapters 6 through 9 covered the basic elements of programming in PowerShell and introduced modules as a way of aggregating your code into reusable pieces. In this chapter, we’ll take things to the next level and talk about metaprogramming, the term used to describe the activity of writing programs that create or manipulate other programs. If you’re not already familiar with this concept, you may be asking why you should care. In most environments, if the designer makes a mistake, the user is stuck with the result. This isn’t true in PowerShell. Metaprogramming lets you poke into the heart of the system and make things work the way you need them to.
After receiving the XAML, the workflow execution engine starts processing the steps in the workflow. These individual steps are called activities, which include not only imperative actions but also the if statements, loops, and other flow-control statements that make up the workflow. PowerShell workflow exposes PowerShell commands as activities so the workflow engine can run them, but the control statements are specific to the workflow engine. For each PowerShell command, there is a corresponding activity wrapper that will call it. These wrappers are generated using tools that produce a C# wrapper for the command. The C# wrappers for all the commands in a module are compiled into a new binary module with the word activities inserted into the name (see table 12.2).
To recap, the workflow engine runs the activity, which in turn runs the command. But as you know, PowerShell commands can run only in runspaces. This is shown on the right side of figure 12.1. PowerShell workflow maintains several pools of runspaces that are used to execute the individual commands. Of particular interest is the out-of-process runspace pool. This is used by default and guarantees that a failing command won’t cause the workflow host process to fail. This approach makes the workflow execution significantly more reliable—but at a cost. Running commands out of process adds a lot of overhead because of the need to serialize data between the workflow host process and the out-of-process runspace host. To improve performance, you can also choose to run activities in process but at some risk of destabilizing the engine (usually a pretty small risk).
The assembly Microsoft.PowerShell.Activities doesn’t have a corresponding cmdlet module because it contains a set of activities that are part of the PowerShell workflow runtime and is loaded when workflows are used.