Can you please add more 2socket tests here? At least something with boundary conditions (everything is consumed, not enough pools and two pools are being consumed)? Just to cover all the possible scenarios. The algorithm is complex and I dont see any issues, but this should be very carefuly covered with unit tests.

The above tests covers it, but not the multi-socket scenarios. Otherwise ACK - good catch.