Default How do dual sim phones work?

For example I was looking at this one on amazon
Samsung Galaxy S4 Mini Gt-i9192 Black Gsm Unlocked Cell Phone Dual Sim

But I'm still not entirely sure how it works. For example my apps, how would the device know which carrier data plan to use? Wouldn't matter too much as they are both unlimited plans but what about text messages? Usually there is one text message default app. How would it know which carrier phone number to send the text as? Any cons? battery life? Any other dual sim device recommendations?