Friday, February 25, 2005

Programs

Computer programs are simply large lists of instructions for the computer to execute, perhaps with tables of data. Many computer programs contain millions of instructions, and many of those instructions are executed repeatedly. A typical modern PC(in the year 2003) can execute around 2-3 billion instructions per second. Computers do not gain their extraordinary capabilities through the ability to execute complex instructions. Rather, they do millions of simple instructions arranged by people known as "programmers." Good programmers develop sets of instructions to do common tasks (for instance, draw a dot on screen) and then make those sets of instructions available to other programmers.
Nowadays, most computers appear to execute several programs at the same time. This is usually referred to as multitasking. In reality, the CPU executes instructions from one program, then after a short period of time, it switches to a second program and executes some of its instructions. This small interval of time is often referred to as a time slice. This creates the illusion of multiple programs being executed simultaneously by sharing the CPU's time between the programs. This is similar to how a movie is simply a rapid succession of still frames. The operating system is the program that usually controls this time sharing.