An operating system acts as an intermediary between the user and computer hardware. It provides an environment for users to run programs conveniently and efficiently by managing computer resources and hardware. An operating system performs important functions like process management, I/O operations, file system manipulation, communication, error detection, resource allocation, and protection. It uses process control blocks to store information about running processes and manages their different states which include new, ready, running, waiting, blocked, and terminated.