<P> With the aid of the firmware and device drivers, the kernel provides the most basic level of control over all of the computer's hardware devices . It manages memory access for programs in the RAM, it determines which programs get access to which hardware resources, it sets up or resets the CPU's operating states for optimal operation at all times, and it organizes the data for long - term non-volatile storage with file systems on such media as disks, tapes, flash memory, etc . </P> <P> The operating system provides an interface between an application program and the computer hardware, so that an application program can interact with the hardware only by obeying rules and procedures programmed into the operating system . The operating system is also a set of services which simplify development and execution of application programs . Executing an application program involves the creation of a process by the operating system kernel which assigns memory space and other resources, establishes a priority for the process in multi-tasking systems, loads program binary code into memory, and initiates execution of the application program which then interacts with the user and with hardware devices . </P> <P> Interrupts are central to operating systems, as they provide an efficient way for the operating system to interact with and react to its environment . The alternative--having the operating system "watch" the various sources of input for events (polling) that require action--can be found in older systems with very small stacks (50 or 60 bytes) but is unusual in modern systems with large stacks . Interrupt - based programming is directly supported by most modern CPUs . Interrupts provide a computer with a way of automatically saving local register contexts, and running specific code in response to events . Even very basic computers support hardware interrupts, and allow the programmer to specify code which may be run when that event takes place . </P> <P> When an interrupt is received, the computer's hardware automatically suspends whatever program is currently running, saves its status, and runs computer code previously associated with the interrupt; this is analogous to placing a bookmark in a book in response to a phone call . In modern operating systems, interrupts are handled by the operating system's kernel . Interrupts may come from either the computer's hardware or the running program . </P>

Why does computer hardware need an operating system