When most end-users encounter computers, they are working on what are sometimes referred to as "virtual machines." In other words, when you interact with a computer or smart phone, there are many layers of software between you and the device you are using. Computers are actually very simple devices, that can store binary data (bits that can have the value of 0 or 1) and perform a very limited set of operations on those bits. What enables computers to perform such operations as accepting input from keyboards and mice and displaying output on monitors is a combination of software and firmware (firmware is basically software hardwired into a system).
The operating system of a computer is a type of managerial software that handles many of the computer's administrative functions, such as switching between tasks. The key function of an operating system is actually to execute a wait loop, a sequence of code in which it looks for interrupts or signals from various devices (keyboard, mouse, internal clock, etc.) to see if anything needs to be done. Then, if the operating system sees that it has received one or more such signals, it responds by transferring control to an appropriate piece of software (either an operating system module or an application) to deal with the interrupt. Operating systems also provide standard interfaces for application software and handle issues such as memory management, allocating resources among various tasks, resolving conflicts among tasks, and handling interfaces with external devices, so that people writing application software such as word processors or spread sheets can focus on application functionality, and simply use standard commands to write something in a specific font to the screen, for example, rather than dealing with the mechanics of displaying every single pixel in each letter a user will see.