An OS is a program which acts as an interface between computer system users and the computer hardware.
It provides a user-friendly environment in which a user may easily develop and execute programs.
Otherwise, hardware knowledge would be mandatory for computer programming.