Figure 1 shows the architecture pretty much everything uses. It's done this way because it's simple and effective.
Basically ReactiveJelly has it right and there is KCL at a node that joins the DC output of the power adapter, the system and the battery. When the adapter is present, if the system draws more than the adapter can supply, the difference comes from the battery, discharging it. if the adapter can provide more than the system needs the difference goes to the battery, charging it.
The main issue is modern systems can change their load way faster than the adapter can respond. Therefore it's up to the battery to make up the difference during these rapid transients preventing system shutdown. As long as it doesn't happen too much (and the system might choose to throttle to guarantee this if is not true) the battery charges on average.
In the end the systems are a complicated thing because they are balancing: safety, battery lifetime, wanting to support many sizes of adapters, thermal considerations, charge time and system performance. And everyone has their own opinions on how to prioritize things.
I’v found this out when looking at what are the purpose of various chips on MacBook Air motherboard.
And suddenly things that didn’t make sense now makes sense: laptop with a dead battery is unbearably slow due to CPU throttling to 600 or 800Mhz. Unusable piece of trash until battery changed.
Figure 1 shows the architecture pretty much everything uses. It's done this way because it's simple and effective.
Basically ReactiveJelly has it right and there is KCL at a node that joins the DC output of the power adapter, the system and the battery. When the adapter is present, if the system draws more than the adapter can supply, the difference comes from the battery, discharging it. if the adapter can provide more than the system needs the difference goes to the battery, charging it.
The main issue is modern systems can change their load way faster than the adapter can respond. Therefore it's up to the battery to make up the difference during these rapid transients preventing system shutdown. As long as it doesn't happen too much (and the system might choose to throttle to guarantee this if is not true) the battery charges on average.
In the end the systems are a complicated thing because they are balancing: safety, battery lifetime, wanting to support many sizes of adapters, thermal considerations, charge time and system performance. And everyone has their own opinions on how to prioritize things.