Plug and play devices are detected and assigned resources by the operating system, such as I/O addresses and interrupt request (IRQ) lines, through a process known as device enumeration. The operating system maintains a hardware abstraction layer (HAL) or a similar mechanism that allows software applications and drivers to interact with the hardware independently of the specific hardware platform.