Default How does root work?

When ClockworkMod asks if you want to root and you say yes, what is it doing?

As opposed to flashing a standalone rooting tool in recovery?

I seem to recall reading once there's more than one way to run processes as "root": you can carefully manage which apps can elevate, using something like SuperSU, or you can just RUN EVERY PROCESS AS UID 0 which sounds stupid and dangerous.

Just making sure that's not what CWM is doing.

And yes, I searched XDA *and* Google for a bit and didn't come up with a quick answer so I thought I'd just ask here. Maybe the discussion will been benefit everyone not just me.

Sent from my HTC One using xda app-developers app