КАТЕГОРИИ: Архитектура-(3434)Астрономия-(809)Биология-(7483)Биотехнологии-(1457)Военное дело-(14632)Высокие технологии-(1363)География-(913)Геология-(1438)Государство-(451)Демография-(1065)Дом-(47672)Журналистика и СМИ-(912)Изобретательство-(14524)Иностранные языки-(4268)Информатика-(17799)Искусство-(1338)История-(13644)Компьютеры-(11121)Косметика-(55)Кулинария-(373)Культура-(8427)Лингвистика-(374)Литература-(1642)Маркетинг-(23702)Математика-(16968)Машиностроение-(1700)Медицина-(12668)Менеджмент-(24684)Механика-(15423)Науковедение-(506)Образование-(11852)Охрана труда-(3308)Педагогика-(5571)Полиграфия-(1312)Политика-(7869)Право-(5454)Приборостроение-(1369)Программирование-(2801)Производство-(97182)Промышленность-(8706)Психология-(18388)Религия-(3217)Связь-(10668)Сельское хозяйство-(299)Социология-(6455)Спорт-(42831)Строительство-(4793)Торговля-(5050)Транспорт-(2929)Туризм-(1568)Физика-(3942)Философия-(17015)Финансы-(26596)Химия-(22929)Экология-(12095)Экономика-(9961)Электроника-(8441)Электротехника-(4623)Энергетика-(12629)Юриспруденция-(1492)Ядерная техника-(1748) |
Computer structure
The definition of a computer is as follows: A computer is a collection of resources, including digital electronic processing devices, stored programs and sets of data, which, under the control of the stored ргоgrams, automatically inputs, outputs, stores, retrieves and processes the data, and may also transmit data to and receive it from other computers. A computer is capable of drawing reasoned conclusions from the processing it carries out. From the hardware point of view, the essential features of this definition are 'a collection of … digital electronic processing devices'. Computers vary enormously in size, processing power and cost. Nevertheless, all computers consist of one or more functional devices, each carrying out one or mоrе of the tasks described above. Each device performs a precisely specified task, and connects to other modules via defined interfaces. Modules of the same type of computer may be exchanged, and new modules added, without modification to their internal workings. The phrase plug-compatible describes units which may be connected in this manner. Mainframes, minis and micros Very broadly speaking, there are three classes of computers, according to their size and complexity. These classes are known as mainframes, minicomputers (or minis) and microcomputers (or micros). Mainframes are large computers, comprising a number of free-standing units. Mainframes are generally housed in specially designed, air-conditioned rooms. Connections between the units are made by wires running beneath the floor of the room. Mainframes are very powerful, and support a number of applications running concurrently. Examples of mainframes are the ICL 2900 series, the IBM 3000 series and the Burroughs B6700 series. Very large mainframes are known as supercomputers. These include the Cyber 205 and the Cray 2. Minicomputers are smaller than mainframes, with several functional devices mounted in a rack in a single unit. Minicomputers do not generally require an air-conditioned environment. They are often to be found in laboratories, factories and offices. Minicomputers can support more than one application running concurrently, though not as many as mainframes. The Digital Equipment Vaxseries is the most popular minicomputer. Others are made by Prime, Data General and Hewlett Packard. Microcomputers are the newest addition to the computer family. They are small and cheap, and are (generally) contained in a few small units. Their distinguishing feature is that processing is carried out on a single microprocessor chip. Although they are very versatile, microcomputers саn only support one application at any one time. Examples of microcomputers are the IBM PC, the Apple Macintosh and the Research Machines Nimbus. The classification of computers into mainframes, minis and micros is only very approximate. Computers are getting smaller and more powerful all the time. Micros are being introduced with the capability of minis only a few years old. Minicomputers are incorporating microprocessors to assume the capability of mainframes.
What is a high level language? A high level language is a problem oriented programming language, whereas a low level language is machine oriented. In other words, a high level language is a convenient and simple means of describing the information structures and sequences of actions required to perform a particular task. A high level language is independent of the architecture of the computer which supports it. This has two major advantages. Firstly, the person writing the programs does not have to know anything about the computer on which the program will be run. Secondly, programs are portable, that is, the same program can (in theory) be run on different types of computer. However, this feature of machine independence is not always achieved in practice. In most cases, programs in high level languages are shorter than equivalent programs in low level languages. However, conciseness can be carried too far, to the point where programs become impossible to understand. More important features of a high level language are its ability to reflect clearly the structure of programs written in it, and its readability. High level languages may be broadly classified as general-purpose or special-purpose. General-purpose languages are intended to be equally well suited to business, scientific, engineering or systems software tasks. The commonest general-purpose languages are Algol 68 and PL/1. The language Ada also falls into this category. Because of their broad capabilities, these languages are large and relatively difficult to use. The commonest categories of special-purpose languages are commercial, scientific and educational. In the commercial field, Cobol still reigns supreme, while Fortran is still the most widely used scientific language. In the computer education field, Basic is widely used in schools, with Logo and Prolog gaining popularity. Pascal is the most popular language at universities. Pascal is a powerful general-purpose language in its own right. Another way of classifying high level languages is as procedural and declarative languages. Procedural languages state how a task is to be performed, often breaking programs into procedures, each of which specifies how a particular operation is to be performed. All the early high level languages are procedural, with Algol, Pascal and Ada as typical examples. Declarative programming languages describe the data structures and relationships between data relevant to a particular task, and specify what the objective of the task is. The process by which the task is to be carried out is not stated explicitly in the program This process is determined by the language translation system. Prolog is an example of a declarative programming language. The defining characteristics of a high level language are problem-orientation and machine independence. The first objective of a high level language is to provide a convenient means of expressing the solution to a problem. There are two other common ways of doing this - mathematics, and natural languages, such as English. Most high level languages borrow, without much modification, concepts and symbols from mathematics. The problem with natural languages is that in their full richness and complexity, they are quite impossible to use to instruct a computer. Nevertheless, high level languages use words from natural languages, and allow these words, and mathematical symbols, to be combined according to various rules. These rules create the structure of programs written in the language. The result, in a good high level language, is a clear structure, not too different from our customary ways of thinking and expressing ourselves. This discussion leads to the second objective of high level languages - simplicity. Simplicity is achieved by a small set of basic operations, a few clear rules for combining these operations, and, above all, the avoidance of special cases. The third objective of a high level language is efficiency. Programs in the language must be able to be translated into machine code fairly quickly, and the resulting machine code must run efficiently. This objective almost always conflicts with the first two. Most high level languages reflect a compromise between these objectives. The final objective is readability of programs. Many languages allow for the inclusion of comments or additional 'noise' words, to make programs easier to read. However, a good high level language should enable programs to be written which are clear to read without additional comments. Regrettably, some high level languages ignore this objective altogether.
Features of High Level Languages The character set used by a language is the set of all characters which may be used in programs written in the language. Almost all languages use letters and decimal digits. Most high level languages use reserved words. These are words which have a specific meaning in programs, and may not be used by the programmer for any other purpose. For example, in Pascal, reserved words include read, if …then … else and write. Some languages permit abbreviations of reserved words. The size and complexity of a language can he measured by the number of reserved words it uses. For example, Occam has 28 reserved words, while Ada uses more than sixty. Perhaps the most important feature of a high level language is the way in which programs in it are structured. The structure of a program is specified by a set of rules, called rules of syntax. Different languages have different ways of expressing these rules. In some, the rules are written in concise English. Others use syntax diagrams, while others (notably Algol) use a notation originally called Backus-Naur form, now known as BNF. Much attention has been devoted, in the development and use of high level languages, to the way in which programs are split up into blocks or modules, each module doing a specific task. In some languages, notably Fortran, these blocks are called subroutines, in others such as Algol and Pascal, these blocks are called procedures or functions. Because of the careful structuring of programs into blocks which they permit, Algol, Pascal and similar languages are called block-structured languages. Procedures, functions or subroutines are activated via calls from other parts of the program. For example, if a program contains a function to calculate the square root of a given number, this function is called every time a square root is required in the rest of the program. Most languages permit a procedure or function to call itself, a feature known as recursion. This is an extremely powerful feature for handling such data structures as lists, stacks and trees, and for such tasks as analyzing the structure of arithmetic expressions. An important aspect of high level languages is the way in which they handle the data items and data structures used in a program. Broadly speaking, data items fall into two categories: variables, which can change their value during the running of a program, and constants, which keep the same value. In most program languages, variables are given names, or identifiers. In some languages, such as Fortran and Basic, constants are referred to by their values, while in others, such as Algol and Pascal, constants are also given identifiers. Some program languages require that all variables be declared before they are used. Generally, variables are declared by listing them at the start of the procedure or subroutine in which they are to be used. An attempt to use a variable which has not been declared results in an error. This gives rise to the idea of the scope of a variable. The scope of a variable is the part of a program in which it may be used. Variables which are declared for use in one procedure only are called local variables. Their scope is limited to that procedure. Variables which are declared for use in the whole program are called global variables. Their scope is the whole program. The intention of providing each variable with a scope is to enable a program to be broken up into 'watertight' blocks, or modules. Each block uses only the information it requires. This simplifies the task of designing, writing and testing programs, and limits the effects of errors. Almost all high level languages include the notion of data types. In Basic language, the standard data types are numeric and character strings. These types can be incorporated into arrays, which are tables of items of the same type. In most high level languages, numbers can be integers or real numbers (generally stored in floating point form). PL/I even permits the number of significant figures in a number to be declared. Another common standard data type is Boolean, with the range of values ‘true' and 'false'. Data types can contain single elements, or be structures such as arrays, stacks, lists, trees, etc. A pointer is a data type which contains the address of another data item. Pointers can be used to construct such data structures as lists and trees. For example, a list of peoples names could be constructed as follows:
name name name etc. pointer pointer pointer
Pointer types are only available in certain high level languages, notably Algol and Pascal. The problem with pointers is that careless use of them can result in program errors which are very difficult to detect and correct. Some languages permit the programmer to declare his or her own data types, built up from standard data types. Records can be constructed, containing data of different types. The following section of a Pascal program shows how this can be done.
type name=array (1...20) of char; day= (mon, tues, wed, thur, fri, sat, sun); pay_record=record employee-name: name; payrate: real; hours-worked: •integer; pay: real; payday: day end;
In the above example, char is a standard data type. Variables of type char have values consisting of a single character. The data type 'name' is an array of twenty characters. Variables of the data type 'day' can have one of the values listed in the brackets. The purpose of data types is to make programs more meaningful, and to provide additional checks for errors. For example, if an attempt is made to add an integer variable to a character variable, then an error will be caused.
Дата добавления: 2014-12-24; Просмотров: 958; Нарушение авторских прав?; Мы поможем в написании вашей работы! Нам важно ваше мнение! Был ли полезен опубликованный материал? Да | Нет |