How does Linux kernel detect and plug in your hardware?

“Everything starts with at the Kernel. Operating systems are
using Privilege Rings.

These rings are created by CPU and not by OS. Any OS kernel
operates in Ring 0 which is most privileged level and can
comunicate directly to the hardware and the CPU. Rings 1 and 2 are
commonly used for device drivers. And ring 3 is used for user-space
applications (media players, web servers and anything else user can
communicate to directly). Device drivers are a „bridge”
between user-space applications and hardware. You should note that
in Linux rings 1 and 2 are NOT used (at least this is what I found
out…), because Linux drivers are compilled directly into
kernel or as a dynamic kernel modules (in both cases drivers appear
in at a Ring 0).