Computer program

From Wikipedia for FEVERv2
Jump to navigation Jump to search

For the TV program, see The Computer Programme. Computer program_sentence_0

A computer program is a collection of instructions that can be executed by a computer to perform a specific task. Computer program_sentence_1

A computer program is usually written by a computer programmer in a programming language. Computer program_sentence_2

From the program in its human-readable form of source code, a compiler or assembler can derive machine code—a form consisting of instructions that the computer can directly execute. Computer program_sentence_3

Alternatively, a computer program may be executed with the aid of an interpreter. Computer program_sentence_4

A collection of computer programs, libraries, and related data are referred to as software. Computer program_sentence_5

Computer programs may be categorized along functional lines, such as application software and system software. Computer program_sentence_6

The underlying method used for some calculation or manipulation is known as an algorithm. Computer program_sentence_7

History Computer program_section_0

See also: Computer programming § History, Programmer § History, History of computing, History of programming languages, and History of software Computer program_sentence_8

Code-breaking algorithms have existed for centuries. Computer program_sentence_9

In the 9th century, the Arab mathematician Al-Kindi described a cryptographic algorithm for deciphering encrypted code, in A Manuscript On Deciphering Cryptographic Messages. Computer program_sentence_10

He gave the first description of cryptanalysis by frequency analysis, the earliest code-breaking algorithm. Computer program_sentence_11

Early programmable machines Computer program_section_1

The earliest programmable machines preceded the invention of the digital computer. Computer program_sentence_12

As early as the 9th century, a programmable music sequencer was invented by the Persian Banu Musa brothers, who described an automated mechanical flute player in the Book of Ingenious Devices. Computer program_sentence_13

In 1206, the Arab engineer Al-Jazari invented a programmable drum machine where musical mechanical automata could be made to play different rhythms and drum patterns. Computer program_sentence_14

In 1801, Joseph-Marie Jacquard devised a loom that would weave a pattern by following a series of perforated cards. Computer program_sentence_15

Patterns could be woven and repeated by arranging the cards. Computer program_sentence_16

Analytical Engine Computer program_section_2

In 1837, Charles Babbage was inspired by Jacquard's loom to attempt to build the Analytical Engine. Computer program_sentence_17

The names of the components of the calculating device were borrowed from the textile industry. Computer program_sentence_18

In the textile industry, yarn was brought from the store to be milled. Computer program_sentence_19

The device would have had a "store"—memory to hold 1,000 numbers of 40 decimal digits each. Computer program_sentence_20

Numbers from the "store" would then have then been transferred to the "mill" (analogous to the CPU of a modern machine), for processing. Computer program_sentence_21

A "thread" is the execution of programmed instructions by the device. Computer program_sentence_22

It was programmed using two sets of perforated cards—one to direct the operation and the other for the input variables. Computer program_sentence_23

However, after more than 17,000 pounds of the British government's money, the thousands of cogged wheels and gears never fully worked together. Computer program_sentence_24

During a nine-month period in 1842–43, Ada Lovelace translated the memoir of Italian mathematician Luigi Menabrea. Computer program_sentence_25

The memoir covered the Analytical Engine. Computer program_sentence_26

The translation contained Note G which completely detailed a method for calculating Bernoulli numbers using the Analytical Engine. Computer program_sentence_27

This note is recognized by some historians as the world's first written computer program. Computer program_sentence_28

Universal Turing machine Computer program_section_3

In 1936, Alan Turing introduced the Universal Turing machine—a theoretical device that can model every computation that can be performed on a Turing complete computing machine. Computer program_sentence_29

It is a finite-state machine that has an infinitely long read/write tape. Computer program_sentence_30

The machine can move the tape back and forth, changing its contents as it performs an algorithm. Computer program_sentence_31

The machine starts in the initial state, goes through a sequence of steps, and halts when it encounters the halt state. Computer program_sentence_32

This machine is considered by some to be the origin of the stored-program computer—used by John von Neumann (1946) for the "Electronic Computing Instrument" that now bears the von Neumann architecture name. Computer program_sentence_33

Early programmable computers Computer program_section_4

The Z3 computer, invented by Konrad Zuse (1941) in Germany, was a digital and programmable computer. Computer program_sentence_34

A digital computer uses electricity as the calculating component. Computer program_sentence_35

The Z3 contained 2,400 relays to create the circuits. Computer program_sentence_36

The circuits provided a binary, floating-point, nine-instruction computer. Computer program_sentence_37

Programming the Z3 was through a specially designed keyboard and punched tape. Computer program_sentence_38

The Electronic Numerical Integrator And Computer (Fall 1945) was a Turing complete, general-purpose computer that used 17,468 vacuum tubes to create the circuits. Computer program_sentence_39

At its core, it was a series of Pascalines wired together. Computer program_sentence_40

Its 40 units weighed 30 tons, occupied 1,800 square feet (167 m), and consumed $650 per hour (in 1940s currency) in electricity when idle. Computer program_sentence_41

It had 20 base-10 accumulators. Computer program_sentence_42

Programming the ENIAC took up to two months. Computer program_sentence_43

Three function tables were on wheels and needed to be rolled to fixed function panels. Computer program_sentence_44

Function tables were connected to function panels using heavy black cables. Computer program_sentence_45

Each function table had 728 rotating knobs. Computer program_sentence_46

Programming the ENIAC also involved setting some of the 3,000 switches. Computer program_sentence_47

Debugging a program took a week. Computer program_sentence_48

The programmers of the ENIAC were women who were known collectively as the "ENIAC girls" and included Jean Jennings Bartik, Betty Holberton, Marlyn Wescoff, Kathleen McNulty, Ruth Teitelbaum, and Frances Spence. Computer program_sentence_49

The ENIAC featured parallel operations. Computer program_sentence_50

Different sets of accumulators could simultaneously work on different algorithms. Computer program_sentence_51

It used punched card machines for input and output, and it was controlled with a clock signal. Computer program_sentence_52

It ran for eight years, calculating hydrogen bomb parameters, predicting weather patterns, and producing firing tables to aim artillery guns. Computer program_sentence_53

The Manchester Baby (June 1948) was a stored-program computer. Computer program_sentence_54

Programming transitioned away from moving cables and setting dials; instead, a computer program was stored in memory as numbers. Computer program_sentence_55

Only three bits of memory were available to store each instruction, so it was limited to eight instructions. Computer program_sentence_56

32 switches were available for programming. Computer program_sentence_57

Later computers Computer program_section_5

Computers manufactured until the 1970s had front-panel switches for programming. Computer program_sentence_58

The computer program was written on paper for reference. Computer program_sentence_59

An instruction was represented by a configuration of on/off settings. Computer program_sentence_60

After setting the configuration, an execute button was pressed. Computer program_sentence_61

This process was then repeated. Computer program_sentence_62

Computer programs also were manually input via paper tape or punched cards. Computer program_sentence_63

After the medium was loaded, the starting address was set via switches, and the execute button pressed. Computer program_sentence_64

In 1961, the Burroughs B5000 was built specifically to be programmed in the ALGOL 60 language. Computer program_sentence_65

The hardware featured circuits to ease the compile phase. Computer program_sentence_66

In 1964, the IBM System/360 was a line of six computers each having the same instruction set architecture. Computer program_sentence_67

The Model 30 was the smallest and least expensive. Computer program_sentence_68

Customers could upgrade and retain the same application software. Computer program_sentence_69

Each System/360 model featured multiprogramming. Computer program_sentence_70

With operating system support, multiple programs could be in memory at once. Computer program_sentence_71

When one was waiting for input/output, another could compute. Computer program_sentence_72

Each model also could emulate other computers. Computer program_sentence_73

Customers could upgrade to the System/360 and retain their IBM 7094 or IBM 1401 application software. Computer program_sentence_74

Computer programming Computer program_section_6

Main article: Computer programming Computer program_sentence_75

Computer programming is the process of writing or editing source code. Computer program_sentence_76

Editing source code involves testing, analyzing, refining, and sometimes coordinating with other programmers on a jointly developed program. Computer program_sentence_77

A person who practices this skill is referred to as a computer programmer, software developer, and sometimes coder. Computer program_sentence_78

The sometimes lengthy process of computer programming is usually referred to as software development. Computer program_sentence_79

The term software engineering is becoming popular as the process is seen as an engineering discipline. Computer program_sentence_80

Programming languages Computer program_section_7

Main article: Programming language Computer program_sentence_81

Computer programs can be categorized by the programming language paradigm used to produce them. Computer program_sentence_82

Two of the main paradigms are imperative and declarative. Computer program_sentence_83

Imperative languages Computer program_section_8

Imperative programming languages specify a sequential algorithm using declarations, expressions, and statements: Computer program_sentence_84

Computer program_unordered_list_0

  • A declaration couples a variable name to a datatype – for example: var x: integer;Computer program_item_0_0
  • An expression yields a value – for example: 2 + 2 yields 4Computer program_item_0_1
  • A statement might assign an expression to a variable or use the value of a variable to alter the program's control flow – for example: x := 2 + 2; if x = 4 then do_something();Computer program_item_0_2

One criticism of imperative languages is the side effect of an assignment statement on a class of variables called non-local variables. Computer program_sentence_85

Declarative languages Computer program_section_9

Declarative programming languages describe what computation should be performed and not how to compute it. Computer program_sentence_86

Declarative programs omit the control flow and are considered sets of instructions. Computer program_sentence_87

Two broad categories of declarative languages are functional languages and logical languages. Computer program_sentence_88

The principle behind functional languages (like Haskell) is to not allow side effects, which makes it easier to reason about programs like mathematical functions. Computer program_sentence_89

The principle behind logical languages (like Prolog) is to define the problem to be solved – the goal – and leave the detailed solution to the Prolog system itself. Computer program_sentence_90

The goal is defined by providing a list of subgoals. Computer program_sentence_91

Then each subgoal is defined by further providing a list of its subgoals, etc. Computer program_sentence_92

If a path of subgoals fails to find a solution, then that subgoal is backtracked and another path is systematically attempted. Computer program_sentence_93

Compilation and interpretation Computer program_section_10

A computer program in the form of a human-readable, computer programming language is called source code. Computer program_sentence_94

Source code may be converted into an by a compiler or assembler, or executed immediately with the aid of an interpreter. Computer program_sentence_95

Compilers are used to translate source code from a programming language into either or machine code. Computer program_sentence_96

Object code needs further processing to become machine code, and machine code consists of the central processing unit's native instructions, ready for execution. Computer program_sentence_97

Compiled computer programs are commonly referred to as executables, binary images, or simply as  – a reference to the binary used to store the executable code. Computer program_sentence_98

Some compiled and assembled object programs need to be combined as modules with a linker utility in order to produce an executable program. Computer program_sentence_99

Interpreters are used to execute source code from a programming language line-by-line. Computer program_sentence_100

The interpreter decodes each statement and performs its behavior. Computer program_sentence_101

One advantage of interpreters is that they can easily be extended to an interactive session. Computer program_sentence_102

The programmer is presented with a prompt, and individual lines of code are typed in and performed immediately. Computer program_sentence_103

The main disadvantage of interpreters is computer programs run slower than when compiled. Computer program_sentence_104

Interpreting code is slower because the interpreter must decode each statement and then perform it. Computer program_sentence_105

However, software development may be faster using an interpreter because testing is immediate when the compiling step is omitted. Computer program_sentence_106

Another disadvantage of interpreters is an interpreter must be present on the executing computer. Computer program_sentence_107

By contrast, compiled computer programs need no compiler present during execution. Computer program_sentence_108

Just in time compilers pre-compile computer programs just before execution. Computer program_sentence_109

For example, the Java virtual machine Hotspot contains a Just In Time Compiler which selectively compiles Java bytecode into machine code – but only code which Hotspot predicts is likely to be used many times. Computer program_sentence_110

Either compiled or interpreted programs might be executed in a batch process without human interaction. Computer program_sentence_111

Scripting languages are often used to create batch processes. Computer program_sentence_112

One common scripting language is Unix shell, and its executing environment is called the command-line interface. Computer program_sentence_113

No properties of a programming language require it to be exclusively compiled or exclusively interpreted. Computer program_sentence_114

The categorization usually reflects the most popular method of language execution. Computer program_sentence_115

For example, Java is thought of as an interpreted language and C a compiled language, despite the existence of Java compilers and C interpreters. Computer program_sentence_116

Storage and execution Computer program_section_11

Typically, computer programs are stored in non-volatile memory until requested either directly or indirectly to be executed by the computer user. Computer program_sentence_117

Upon such a request, the program is loaded into random-access memory, by a computer program called an operating system, where it can be accessed directly by the central processor. Computer program_sentence_118

The central processor then executes ("runs") the program, instruction by instruction, until termination. Computer program_sentence_119

A program in execution is called a process. Computer program_sentence_120

Termination is either by normal self-termination, by user intervention, or by error – software or hardware error. Computer program_sentence_121

Simultaneous execution Computer program_section_12

See also: Process (computing) and Multiprocessing Computer program_sentence_122

Many operating systems support multitasking which enables many computer programs to appear to run simultaneously on one computer. Computer program_sentence_123

Operating systems may run multiple programs through process scheduling – a software mechanism to switch the CPU among processes often so users can interact with each program while it runs. Computer program_sentence_124

Within hardware, modern day multiprocessor computers or computers with multicore processors may run multiple programs. Computer program_sentence_125

Self-modifying programs Computer program_section_13

Main article: Self-modifying code Computer program_sentence_126

A computer program in execution is normally treated as being different from the data the program operates on. Computer program_sentence_127

However, in some cases, this distinction is blurred when a computer program modifies itself. Computer program_sentence_128

The modified computer program is subsequently executed as part of the same program. Computer program_sentence_129

Self-modifying code is possible for programs written in machine code, assembly language, Lisp, C, COBOL, PL/1, and Prolog. Computer program_sentence_130

Functional categories Computer program_section_14

Computer programs may be categorized along functional lines. Computer program_sentence_131

The main functional categories are application software and system software. Computer program_sentence_132

System software includes the operating system which couples computer hardware with application software. Computer program_sentence_133

The purpose of the operating system is to provide an environment in which application software executes in a convenient and efficient manner. Computer program_sentence_134

In addition to the operating system, system software includes embedded programs, boot programs, and micro programs. Computer program_sentence_135

Application software designed for end users have a user interface. Computer program_sentence_136

Application software not designed for the end user includes middleware, which couples one application with another. Computer program_sentence_137

Application software also includes utility programs. Computer program_sentence_138

The distinction between system software and application software is under debate. Computer program_sentence_139

Application software Computer program_section_15

Main article: Application software Computer program_sentence_140

There are many types of application software: Computer program_sentence_141

Computer program_unordered_list_1

Utility programs Computer program_section_16

Utility programs are application programs designed to aid system administrators and computer programmers. Computer program_sentence_142

Operating system Computer program_section_17

See also: Operating system Computer program_sentence_143

An operating system is the low-level software that supports a computer's basic functions, such as scheduling tasks and controlling peripherals. Computer program_sentence_144

In the 1950s, the programmer, who was also the operator, would write a program and run it. Computer program_sentence_145

After the program finished executing, the output may have been printed, or it may have been punched onto paper tape or cards for later processing. Computer program_sentence_146

More often than not the program did not work. Computer program_sentence_147

The programmer then looked at the console lights and fiddled with the console switches. Computer program_sentence_148

If less fortunate, a memory printout was made for further study. Computer program_sentence_149

In the 1960s, programmers reduced the amount of wasted time by automating the operator's job. Computer program_sentence_150

A program called an operating system was kept in the computer at all times. Computer program_sentence_151

Originally, operating systems were programmed in assembly; however, modern operating systems are typically written in C. Computer program_sentence_152

Boot program Computer program_section_18

A stored-program computer requires an initial computer program stored in its read-only memory to boot. Computer program_sentence_153

The boot process is to identify and initialize all aspects of the system, from processor registers to device controllers to memory contents. Computer program_sentence_154

Following the initialization process, this initial computer program loads the operating system and sets the program counter to begin normal operations. Computer program_sentence_155

Embedded programs Computer program_section_19

Independent of the host computer, a hardware device might have embedded firmware to control its operation. Computer program_sentence_156

Firmware is used when the computer program is rarely or never expected to change, or when the program must not be lost when the power is off. Computer program_sentence_157

Microcode programs Computer program_section_20

Main article: Microcode Computer program_sentence_158

Microcode programs control some central processing units and some other hardware. Computer program_sentence_159

This code moves data between the registers, buses, arithmetic logic units, and other functional units in the CPU. Computer program_sentence_160

Unlike conventional programs, microcode is not usually written by, or even visible to, the end users of systems, and is usually provided by the manufacturer, and is considered internal to the device. Computer program_sentence_161

See also Computer program_section_21

Computer program_unordered_list_2


Credits to the contents of this page go to the authors of the corresponding Wikipedia page: en.wikipedia.org/wiki/Computer program.