So, Machine B has the portal is also a JBoss AS?
You can place the BPM engine in any of those servers. If you need the portal interacting with the process engine you will need to write that code to interact with the rest server that you can host in any of those machines.
Cheers