Computer hardware is a physical portion of a computer system and is generally tasked with functions specific to that type of equipment, while software is a set of instructions for hardware to follow in performing a specific task. However, the line between software and hardware is not always distinct.
Almost all the physical components of a computer system are classified as hardware, including its central processing unit, monitors, keyboards and hard disk drives. In contrast, software is a series of instructions stored in a computer's memory that cause a particular piece of hardware how to perform a task when the instructions are executed. For example, a simple program designed to add two numbers together instructs a computer's central processing unit to read input from a keyboard, place the numbers into its memory, add the numbers together, and finally to output the results to the computer's monitor.
In most cases, software is loaded into a computer's memory while it is used and otherwise stored on a hard disk drive, CD-ROM or other media device. However, some types of software are stored in memory integrated with a piece of hardware. This software is commonly referred to as firmware, and it contains the instructions that are required for a piece of hardware to carry out basic tasks. For example, the firmware of a hard disk drive contains the instructions for spinning the drive's discs and reading and writing information.