Menu
Is free
registration
home  /  ON/ Birthday of the programming language hell. Want to know everything

Birthday of the programming language hell. Want to know everything

Sergey Bobrovsky

The history of this language does not begin in 1975, when the US Department of Defense (MoD) decided to start developing a unified programming language for the American armed forces, and later for the entire NATO. Its history begins with the name, for Ada is the name of Augusta Ada Lovelace, who is considered the first programmer, the daughter of the English poet Byron and a certain Anabella Milbank, with whom her husband parted forever a month after the birth of her daughter, who was born on December 10, 1815. In general, the history of cybernetics is shrouded in a dark mystery, and it is only by fragmentary facts that one can judge that the founders of this science in the last two hundred years were various mystics and occultists, starting with August de Morgan, one of the teachers of Ada, and ending with Norbert Wiener's associates who studied the methods of formation public opinion and manipulation.

After Charles Babbage constructed his mechanical computing machine, Ada wrote the first program for her to calculate the Bernoulli coefficients. In the future, she developed a real theory of programming, introduced the concept of a cycle and a few more key terms that students of cybernetic faculties study almost literally today! Today, Ada is known to everyone as the first programmer - and nothing more, but I wonder why a young girl has such unique abilities? She herself answered this question frankly: “I swear by the Devil that within 10 years I will suck a certain amount of vital blood from the mysteries of the Universe, and in a way that ordinary mortal minds and lips could not do. terrifying energy and strength still lie unused in my little flexible being ... ". However, there were no sponsors for the computer project - there were no nuclear missiles yet, and Ada, having lost all her fortune at the races and getting into a dirty story, died at the age of 37, like her famous father.

Therefore, whether the Americans should have extolled Ada so much, using her name as the name for such an ambitious project, is a very controversial question.

But back to the history of the language itself. Five years after the start of the project, hundreds of experts selected from 17 variants the only language that meets the requirements of the MO, developed by a small group under the leadership of the talented scientist Jean Ishbia. The final version of the international standard ISO 8652: 1987 was published in 1987. According to official reports, all the best specialists in the world in the field of programming participated in the creation and improvement of this language, which, however, raises doubts. This, for example, is confirmed by the absence of the concept of an object in the original version of Ada and the lack of participation, for obvious reasons, in this project of Soviet programmers.

Tens of billions of dollars have been invested in the development of Ada's infrastructure all over the world. This led to the emergence of ambitious statements such as "The 20th century will pass under the sign of Ada," however, as usual, life has put everything in its place.

Unfortunately for the US Department of Defense (and, accordingly, fortunately for America's "potential opponents"), the development of a clear standard for this language and the creation of effective compilers were completed just at that time (early 80s), when the software industry was already looming on the horizon. new C ++ language with object ideology. Now it's hard to say what Ada's development committee felt, seeing the growing popularity of C ++ and the old, well-forgotten, object-based thinking paradigm. But the allocated funds had already been spent, the standard had been created, and there was no way back.

The structure of Ada is very similar to Pascal, or more precisely, to Modula. The syntax for most of the operators and descriptions is almost identical to that of Modula, although it appeared almost at the same time as Ada, and it is difficult to say who influenced whom or if at all. In Ada, in particular, quite a lot of different extensions were added, so this language cannot be called compact, in comparison with the same Pascal. In terms of the number of possibilities, it is more likely to resemble PL / 1. But since the main emphasis of the creators of Ada was on meeting the wishes of the American "first departments", the means of data privacy (visibility) and the ability to create separate blocks using only specifications (interface descriptions of modules) from other developers were the most perfect for their time. For example, the programmer who actually wrote the code for calculating the trajectory of a cruise missile had no idea where and for what purposes his module would be used, although he had access to the required specifications of other employees and could debug his code section without any problems. Due to the strict delimitation of access to different levels specifications, sometimes it is even impossible to determine for what and by what means this procedure will be called. However, this desire for independent software development has led to a very complex system of relationships between the specifications of modules and the appearance of some "holes" that can cause side effects, the presence of which, however, the US Department of Defense found it even useful.

The elements of data typing were significantly strengthened, as well as the types themselves were more formalized. All I / O functions have been removed from the standard syntax, and exception handling has become an integral part of the language. In addition, the power of control constructs was pushed to the limit, making Adu the most advanced of the other Pascal-like languages.

Borland soon released its Turbo Pascal, in which the concept of a module was built, and brought its version of Pascal closer to Ada in terms of capabilities, but in the future, attempts to create non-object programming languages ​​of the 3rd generation intended for the development of ultra-large projects, fortunately, were not made. So Ada put a stop to a long line of simple procedural languages, starting with Fortran and Algol. In fact, everything that could be thought of within the framework of the ideology of structured programming was embodied in Hell. Then object programming flourished, and Ada faded into the background.

However, this language still occupies one niche in which it has no equal yet. In addition to compiling modules separately and ensuring hierarchical secrecy of specifications, this language has implemented such a property as support for parallel programming. Taken at a more or less high level in Algol-68, then developed in Module-2, it was embodied in the very powerful tools of Ada, the so-called tasks that can be performed independently of each other on parallel computers. This led to the birth of a whole programming ideology based on tasks that could be performed "pseudo-parallel" - on a computer with one processor. In this case, the problem being solved itself was divided into a set of simultaneously operating procedures that independently interact with each other. It was a bit like a way to solve a problem in Prolog: a certain virtual world is simply described, and then it is, as it were, "launched" into operation, and the solution is found by itself.

It is all the more surprising that the US Department of Defense, for one reason or another, abandoned the object ideology, which was perfectly embodied in

60s in Simul-67, and probably regretted it more than once. True, in the Ada language a kind of pathetic replacement for a number of opportunities provided by object-oriented programming was introduced - the so-called templates, that is, procedures with parameters of undefined types. But all the same, the main advantages of Ada, which allow her today to withstand the onslaught of more developed languages, were, in addition to powerful funding, built-in support for the parallel execution of tasks and powerful means of coordinating their interaction. It should be noted that Ada's main orientation is not at all accounting automation systems in the US Department of Defense, but purely combat missions, for example, such as microprocessor-based real-time navigation of a homing missile, where it is required to simultaneously process information continuously coming from a variety of sensors. ... Previously, such tasks were written in assembly language, which led to many errors and difficulties in maintenance. For such tasks, Ada, of course, suits perfectly well.

However, Ada continues to be positioned as a good tool for developing large software systems... True, now the voices in support of this language sound quieter, something like this: "Ada, at least not worse than C." The US Department of Defense, taking into account its main blunder - the lack of objects, in accordance with modern requirements for software development technology, has developed a new language standard ISO / IEC 8652: 1985 (E). It describes the version of the Ada95 (or Ada9X) language. The most interesting thing is that this version is the world's first object-oriented programming system, on which the international standard was introduced, apparently by order (with C ++, this is not yet possible). In addition, the language has improved the system for coordinating the visibility of data in the specifications of the modules and added tools to improve the efficiency of the parallel tasks.

The US Department of Defense is quite jealous of its dear brainchild and even registered the word "Ada" as its trademark. However, subsequently, instead of the trade mark, the Ministry of Defense decided to use "Ada" as its internal certified mark. The US Department of Defense is not particularly happy about the emergence of commercial versions of this language. Of course, no one has the right to prevent you from writing your own compiler, but in order for it to receive commercial recognition, it must comply with the military standard, and testing is carried out only by the AJPO committee of the US Department of Defense, which very strictly checks the compiler's compliance with many requirements, including, obviously, and purely political.

Nevertheless, various versions of Ada can be obtained, as is usually the case with programming languages, for free, that is, for nothing, just not in a pirated way, but simply freeware versions, and, of course, for money.

Of the free versions, the first thing to highlight is the GNAT compiler - GNU Ada95. It is available in source code from the GNU Project (Free Redistributable Software). It can also work on a computer with one processor, only it is necessary that the operating system supports multitasking. This could be, for example, some version of UNIX or OS / 2. As for MS DOS - guess yourself. However, if you really want to run a hundred or two parallel processes on your personal computer under MS DOS 6.x, then it is quite possible to try Ada / Ed - the compiler and interpreter of the 1987 version of the language, which, however, is completely incompatible with the standard and lacks a number of essential elements ...

If you have money, then the situation, of course, becomes easier. Within the monthly salary of an average Russian programmer, you can buy, for example, FirstAda and write a refrigerator control system. More expensive systems for Windows, OS / 2 or UNIX, certified by the US Department of Defense, you can try to purchase directly from development companies, of which there are about a dozen.

It is interesting that not only the language itself has undergone standardization, which made it possible to create easily portable programs, but also a set of developer aids - various I / O libraries and graphical interface organizations, preprocessors, verifiers, code generators, analyzers of the logical structure of the source code, programs for testing compilers, etc. Of course, there are large packages that include all the standardized development tools, but they seem to be very expensive.

It would be very interesting to find out if the USSR was working on languages ​​designed to solve similar military problems. Or did our specialists write only in Assembler?

Abstract on the topic:

Ada



Plan:

    Introduction
  • 1 Features of the language
  • 2 "Hello, world!" in Hell
  • 3 History
  • 4 Hell in the USSR and Russia
  • 5 Criticism
  • 6 Distribution, perspectives
  • 7 Operating systems written in Ada
  • 8 Compilers of Hell
  • 9 Derived languages
  • 10 Interesting Facts
  • Notes (edit)
    Literature

Introduction

Hell (Ada) is a programming language created in 1979-1980 as a result of a project undertaken by the US Department of Defense with the aim of developing a unified programming language for embedded systems (that is, control systems for automated complexes operating in real time). They meant, first of all, on-board control systems for military objects (ships, aircraft, tanks, missiles, shells, etc.). The developers were not faced with the task of creating a universal language, therefore the decisions made by the authors of Ada must be perceived in the context of the peculiarities of the chosen subject area. The language is named after Ada Lovelace.


1. Features of the language

In its original version, standardized in 1983, Ada is a structured, modular programming language that contains high-level programming tools for parallel processes. Ada's syntax is inherited from languages ​​like Algol or Pascal, but expanded, and also made more strict and logical. Ada is a strongly typed language, it excludes working with objects that have no types, and automatic type conversions are reduced to an absolute minimum. In the 1995 standard, the basic means of object-oriented programming were added to the language; in the 2007 standard, these means were supplemented, so modern Ada is an object-oriented programming language.

Of the features of the syntax, it can be noted:

  • The language is case-insensitive.
  • The programs are modular, the mechanism for controlling the import-export of descriptions between modules includes two different directives: one for connecting another module (with), the other for importing its descriptions (use). It is also possible to rename the module during import (rename) - this option allows you to use more convenient identifiers for the package designation.
  • Packages (one of the types of modules) can contain a header and a personal part - what is contained in it is not exported and is not available to other modules.
  • The mechanism of generalized (customizable) modules is supported: packages, procedures and functions that allow describing generalized data processing algorithms without specifying a specific type.
  • A developed system of types, both built-in and generated by the programmer. There are many ways to create new types, the language supports two different concepts: "subtype" and "derived type". Variables of type and subtype are compatible, variables of type and its derived type are not.
  • Exception handling facilities.
  • Developed means of referring to procedures and functions: input and output parameters are supported, transfer of actual parameters in an arbitrary order with the indication of formal names, parameters with default values.
  • Overriding procedures, functions and operators is supported - creating several variants of a procedure, function or operator with the same name, but different signatures (types and number of parameters).
  • Constructs built into the language to support parallel programming: the concepts of "task" (a program fragment executed in parallel), "task input" (a means of synchronization and communication of parallel running tasks) are supported; ), there is a SELECT operator for organizing conditional inter-thread interaction (selection of a parallel task with which to interact, depending on the readiness for a rendezvous and some other conditions). In principle, the parallel programming tools available in the language are sufficient to solve a large class of tasks requiring parallel processing, without resorting to external tools, such as additional libraries or operating system APIs.

To meet the reliability requirements, the language is built in such a way that as many errors as possible are detected at compile time. In addition, one of the requirements in the development of the language was the maximally easy readability of the program texts, even at the expense of the ease of writing. The result of this approach was a somewhat "heavy" syntax and many restrictions that are absent in the most common industrial languages ​​(C and C ++) and are often perceived by professional programmers as redundant, for example, the same strong typing. This led to the formation of the idea of ​​Ada as a complex, obscure and inconvenient language to use.


2. "Hello, world!" in Hell

Several different variants of the "Hello, world!" can be seen in the Wikibooks. The differences are due to the need to use the Put_Line library function - there are three different ways of organizing this use in this language.

With Ada.Text_IO; procedure Hello is use Ada.Text_IO; begin Put_Line ("Hello, world!"); end Hello;

Here, to use the Put_Line function, the Ada.Text_IO package containing it is imported using the use construct, which makes it possible to call the function by name without qualification - specifying the name of the package containing the function in the call.


3. History

The development of the language was carried out as part of an international competition organized and funded by the US Department of Defense. The goal of the development was to obtain a programming language that could become a uniform for the development of projects ordered by the military department, mainly for the development of embedded systems for military purposes and for large military computers (based on the iAPX 432 processor from Intel). The work began in 1975, with the formation of a set of requirements for the language, which would fully satisfy the developers of systems of this type. The initial list of requirements, issued under the code name "Straw", was submitted for review to a number of organizations and firms, was consistently refined over the course of two years, eventually turning into a final document called "Steel".

After the completion of the formation of the requirements, an analysis was carried out, which showed that none of the available programming languages ​​satisfies the requirements sufficiently, so it was decided to develop a new language. A competition for its creation was announced in 1977, the developers were asked to be based on one of three languages: Pascal, Algol-68 or PL / 1.

Of the 15 projects submitted for the competition, 4 were selected (all based on Pascal). These projects were sent for further revision. At the next stage, out of 4 projects, two were selected, of which, after the next revision, one was selected. This language was named "Ada" - the group that developed it under the leadership of the Frenchman Jean Ishbia gave the language a name in honor of Augusta Ada King Lovelace (1815-1852), the daughter of the poet J. Byron, who developed programs for Babbage's computer and is considered the first programmer in the world.

In 1983, the language was officially standardized by ANSI. The ANSI / MIL-STD-1815-A-1983 language standard was approved on February 17, 1983. The US Department of Defense has registered the name "Ada" as a registered trademark, prohibiting the release of translators for the language that have not undergone formal compliance testing. The procedure consisted in running a large number (more than 1000) of test programs (the so-called ACVC suite) through the compiler under test, for each of which the test result was uniquely determined: either a successful compilation or a very specific error message. Testing was carried out on the "all or nothing" principle - if at least one test case was processed, the compiler was considered to have failed the test, and the testing was valid only on the hardware and software platform on which it was carried out. Thus, the possibility of the formation of "versions" or "dialects" of the language of Hell was suppressed in the bud.

In 1987, the language of Ada was officially standardized by ISO. From that moment, the US Department of Defense made the language available to the public.

By 1990, there were about 200 compilers in the world that corresponded to the Ada language standard.

In 1995, a new Ada standard was adopted, known as Ada95. The means were introduced into the language object programming... In addition, the language was supplemented with more advanced means for interacting with programs written in other languages.

In March 2007, changes to the Ada standard were published. They mainly touched upon the possibilities of object-oriented programming: interfaces were introduced, the syntax for calling a method that was usual for most hybrid languages ​​was adopted, and a number of additions were made.


4. Hell in the USSR and Russia

In the USSR, in the 1980s, a Working Group on the language of Hell was organized under the State Committee for Science and Technology. The group was engaged in the study of all open (as well as, rumored, secret intelligence obtained) data on the language of Ada and investigated the possibility and feasibility of the development and use of Ada in the USSR. The activities of this group led by the end of the 1980s to the development of Ada compilers for practically all computers used in the USSR. Several books on the language of Hell have been published in Russian.

At Moscow State University, work was carried out to create its own test packages for Ada-translators for compliance with standards. At LSU, to create the Ada-system, the Pallada system, previously developed for the implementation of Algol-68, was used, which was transferred to Ada. The system contains an integrated development environment, a compiler, a text editor, a debugger, libraries, a version control system, and a command interpreter.

After the collapse of the USSR, work on the spread of Ada was practically interrupted. True, three programs for the development of software development in Ada were adopted (in the Ministry of Defense, the Ministry of Civil Aviation and the Ministry of Education and Science), but their development is being carried out slowly and uncoordinated. As a result, the Ada language is little known in Russia, the majority of modern Russian programmers consider it a "dead language" and do not know anything about it. Ada is used in Russia and the CIS by individual enthusiasts. Nevertheless, the language is used for industrial software development. There are several known projects developed in Ada working in Russia. Among them:

  • Station of documentary communication of the Ministry of Defense of the Russian Federation. The main task is to ensure the exchange of documentary information in the data transmission networks of the Ministry of Defense Russian Federation... The hardware and software complex was jointly developed by the Computing and Automation Manufacturing Organization (hardware) and a group of programmers in the off-track sector of the Strela North Caucasus Air Traffic Control Center. The software of the complex is written in the Ada programming language using the GNAT compiler. Distributed computing is supported by the GLADE add-on component.
  • A set of standard flight-navigation and communication equipment for a Russian amphibious aircraft Beriev Be-200... The development was carried out by the Scientific Research Institute of Aviation Equipment in Zhukovsky, together with the American firm Allied Signal, Florida, USA. The complex for the development of Ada-systems from the DDC-I company on the Intel 80486 platform was used.

5. Criticism

Since its inception, Ada has been criticized by some recognized authorities in the development of programming languages, primarily for the complexity of the syntax and the large volume. In particular, the language was criticized by Charles Hoare and Niklaus Wirth (who participated with their project in this competition, but dropped out after the first stage), as well as Edsger Dijkstra.

Dijkstra doubted that a language of such complexity as Ada could be observable and manageable.

If Ada is going to issue a standard, it is desirable that it be unambiguously documented. At least two groups have tried to do this; as a result, both produced about 600 pages of formal text. This is much more than is necessary to ensure that it is impossible to even firmly establish that both documents define the same language. The error of the obvious unmanageability of these two documents lies not in the two groups that compiled them, not in the formalism they adopted, but only in the language itself: without providing a formal definition of whether its developers can hide that they are proposing an uncontrollable monster. That Ada will reduce programming problems and increase the reliability of our designs to acceptable limits is just one of those fairy tales that only people with a military background can believe.

Science fiction and scientific reality in computer science (Edsger W. Dijkstra, EWD952)

Hoare expressed his regret that "rattles and trinkets have prevailed over the fundamental requirements of reliability and safety" and warned against "an armada of missiles flying in the wrong direction due to an undetected error in Ada's compiler." Niklaus Wirth spoke more restrainedly, but also negatively. He said, “Too many things fall on the programmer. I don't think that after studying a third of Ada, you can work normally. If you do not master all the details of the language, then in the future you can stumble on them, and this will lead to unpleasant consequences. " Jean Ishbia, head of the Ada development team, expressing his "respect and admiration" for Wirth, disagreed with him, saying: "Wirth believes in simple solutions difficult problems. I don't believe in such miracles. Complex problems require complex solutions. "

The procedure for checking the compiler's compliance with the language standard by testing also raises doubts. It is clear from general considerations that testing can find inconsistencies, but cannot guarantee correctness. A practical confirmation of this is the fact that certified compilers, when tested on a different set of tests, found non-conformity to the standard.

Ada proponents argue that the only alternative to a large and complex language in large projects is the use of several compact languages, which inevitably creates the compatibility problems that Ada was designed to get rid of. They also notice that the idea of ​​the complexity of developing in Ada is only partially true: writing a simple program in Ada does take more time than in other less formal languages ​​such as C, but debugging and maintaining programs, especially large and complex ones, is much easier. According to Stephen Zeiger of the Rational Software Corporation, software development in Ada is generally 60% cheaper, and the developed program has 9 times fewer defects than using the C language.


6. Distribution, perspectives

In practice, it turned out that Ada, having occupied its intended niche in the military and related developments of embedded systems, did not go beyond this niche, neither in the West, nor in the USSR, nor in the post-Soviet space. There are many reasons for this. Opponents of the language emphasize its complexity and shortcomings, supporters speak, first of all, about the objective circumstances of the emergence of the language and the negative aspects of the process of its implementation. The opinion of S. I. Rybin, senior researcher at the Research Computing Center of Moscow State University, a consultant to the AdaCore EU company, an expert on the Ada language of the ISO working group on the language standard, is interesting. He believes that Ada owes her failures to two main reasons:

  • During the design of the language, the Pentagon assumed that all new software would be created only in Ada. Because of this, Ada received extremely primitive means of interacting with programs in other languages. In practice, it turned out that writing everything in Ada in general is unrealistic (if only because there was a need to interact with ready-made developments in other languages). Therefore, in industries where there was no strict requirement to "write only in Ada", other languages ​​were preferred, more adapted to a multilingual environment. The 1995 standard solved the problem of interoperability with other languages, but time wasted.
  • Paradoxically, the spread of Ada was hampered by the financial and organizational support of the Pentagon. The Ada programs written for the military ran on the most powerful computing hardware available, so the compiler developers cared first about passing the ACVC tests, and only then about the efficiency of the compiler and the code it generated. In the early 1980s, a microcomputer boom began, and translators for common languages ​​(Pascal, C, BASIC) were quickly optimized for low-power systems. For Ada, there was no incentive for such modernization, as a result, personal computers that became the bulk of the world's computing park a few years later were without a high-quality translator of Ada. Naturally, Ada lost this market segment. The GNAT compiler, high-quality and efficient, has appeared only relatively recently, but here too the time has been lost.

At present, Ada is quite firmly established in the development of large embedded systems of increased reliability, here she has practically no strong competitors. The use of the language is gradually increasing, albeit rather slowly. According to some cautious forecasts [ ], with the reduction in the cost of hardware and the spread of embedded systems with complex software, the market for programs in Ada may grow noticeably, and the use of the language will also grow.

In addition, Ada has, albeit very limited, application in the field of higher education. Special courses on Ada are taught at Moscow State University and Kharkov University. However, according to the same S.I. Rybin,

... now in the post-Soviet space in the field of the software industry and education, an obvious vicious circle has developed: the industry practically does not know about Ada, respectively, from the industry there is no demand for education to train Ada specialists, and new people come from universities to the industry, who know practically nothing about Hell.


7. Operating systems written in Ada

7.1. Embedded systems

  • MaRTE
  • RTEMS - open source OS source code, developed by DARPA US Department of Defense
  • Ravenskar
  • RTOS-32 - proprietary OS

7.2. Systems in development

  • AuroraUX (a project to rewrite the OpenSolaris kernel, and then DragonFly BSD into the Hell language)
  • Lovelace (operating system on the L4 core)

7.3. No longer existing systems

  • BiiN ™
  • Pulse ™
  • AdaOS

8. Hell compilers

Name Company Version Operating system Site
AdaMagic SofCheck Ada 95 ? www.sofcheck.com
AdaMULTI Green Hills Software Ada 83, Ada 95, C, C ++, Fortran Solaris SPARC, GNU / Linux x86, Windows www.ghs.com
DEC Ada Hewlett Packard Ada 83 Openvms h71000.www7.hp.com
GNAT AdaCore Ada 83, Ada 95, Ada 2005, Si Solaris SPARC, Linux x86 / x86-64, Windows, others libre.adacore.com
ICC Irvine Compiler Corporation Ada 83, Ada 95 DEC VAX / VMS, HP 9000/700, Solaris SPARC, DEC Alpha OSF / 1, PC Linux, SGI IRIX, Windows www.irvine.com
Janus / Ada RR Software Ada 83, Ada 95 SCO, UnixWare, Interactive, MS-DOS, Windows www.rrsoftware.com
MAXAda Concurrent Ada 95 Linux / Xeon, PowerPC www.ccur.com
ObjectAda Aonix Ada 95 Solaris SPARC, HP-UX, IBM AIX, Linux, Windows www.aonix.com
PowerAda OC Systems Ada 83, Ada 95 Linux, AIX (Ada 95); IBM System 370/390 (Ada 83) www.ocsystems.com
Rational Apex IBM Rational Ada, C, C ++ Solaris SPARC, Linux www-01.ibm.com
SCORE DDC-I Ada 83, Ada 95, Si, Fortran Solaris SPARC, Windows www.ddci.com
XD Ada SWEP-EDS Ada 83 OpenVMS Alpha / VAX www.swep-eds.com
XGC Ada XGC Software Ada 83, Ada 95, Si Solaris SPARC, PC Linux, Windows (Cygwin) www.xgc.com

With the exception of GNAT and XGC (for some platforms), the above compilers are paid. Some companies, such as Aonix, offer free demos that are limited in either time of use or functionality.

The NetBeans and Eclipse IDEs have plugins for working with Ada.


9. Derived languages

The syntax of the Ada language is used in languages ​​such as:

  • PL / SQL

10. Interesting facts

  • Formally, the competition for the development of the language, as a result of which the Ada language was created, was anonymous - groups of developers presented their projects under code names so that the competition committee could not take into account the personality of the developers when choosing the winner. But in practice, as one of the members of the commission wrote, the tastes of the developers were so different that it was not difficult to identify the author of the project.
  • All languages ​​that have come down to the last rounds of this competition were based on Pascal. In this regard, Ada can be tentatively characterized as Pascal, developed taking into account the given five basic requirements. At the same time, the authors went mainly along the path of expanding Pascal with new elements. The result is a significantly more complex language.
  • In the Russian language, there are jokes associated with the ambiguity of the expression "The Language of Hell", including those based on a parallel with the Russian Algorithmic Language, also known as the "Language of PARADISE". The programming folklore also included the conclusion of an article by Soviet propagandist Melor Sturua (1984):

The language of the Pentagon is the enemy of the world. The language of "Ada" is the voice of a thermonuclear hell ... In the language of "Ada" a curse is heard to the human race.


Notes (edit)

  1. Reference guide to the language of Ada 83. Chapter 1.3. Purposes and sources of development - www.ada-ru.org/arm83/ch01s03.html
  2. Vadim Stankevich. Lady Hell - www.kv.by/index2006451104.htm
  3. Updated standard on iso.org - www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=45001
  4. Bryabrin VM Software for personal computers. Moscow: Nauka, 1988.
  5. 1 2 S. I. Rybin's interview - www.ada-ru.org/wiki/rybin
  6. , Object-Oriented Programming Languages, NET Platform Programming Languages, Ada, Ada Code Sample Articles.
    Text available under the Creative Commons Attribution-ShareAlike license.

If you ask a domestic IT specialist: "What is Hell?", Most will just shrug their shoulders in surprise, and some will even say that this is a dead language, once invented by the Pentagon, but now practically not used. In fact, Ada today is quite a successful programming language that is actively used in various fields. True, most Russian programmers know little about it.

Probably everyone who had to use the fourteenth line of the Paris Metro was surprised when he first saw a train in which there is no driver's cab. The movement of trains on this line is completely controlled by the Ada program.

Despite everything, in some areas of technology, Russia is still "ahead of the rest of the planet." And one of them is the design and production of amphibious aircraft. The internationally recognized leader in this area is TANTK im. G.M. Beriev. The company recently acquired Ada-based onboard software development tools for use in upgrading its latest model Be-200.

Meanwhile, the majority of domestic IT specialists, at best, do not know anything about the language of Hell, at worst, they have a completely wrong idea of ​​Hell as a monster language, once invented by the Pentagon to develop military systems, but now completely forgotten.

A bit of history

The official birthday of the Ada programming language can be considered February 17, 1983 - the date of approval of the ANSI / MIL-STD-1815-A-1983 standard.

The technical and administrative measures taken by the Ministry of Defense as part of the project for the creation and implementation of Ada completely prevented the emergence and spread of dialects of the language. From 1983 to the present, all industrial implementations support the current Ada standard. When it comes to subsets of Ada, these subsets are determined not by the implementation, but by the development standards for a particular class of systems.

In 1987, the ANSI standard, without a single change, was approved as an ISO standard (ISO / IEC 8652), and when the need to revise the standard became necessary in the early 90s, the revision work was also carried out under the direction and funds of the US Department of Defense. A new international project was launched, which ended with the approval at the end of 1994 and publication at the beginning of 1995 of a new version of the ISO / IEC 8652 standard. It is this document that serves as the definition of the Ada programming language today.

In the USSR in the early 80s was formed Working group on the programming language of Ada at the State Committee for Science and Technology. All open information about the project was carefully collected and analyzed, and through the efforts of special services, it was obtained and closed Information... Projects were organized to implement Ada for virtually all computer architectures then in use, and some of them were very successful. The collapse of the USSR put an end to this activity. Today Ada is used in Russia and the CIS by individual enthusiasts.

What is Ada

All modern industrial languages ​​provide essentially the same basic set of capabilities, differing not in what they allow you to do, but in how they allow you to do it. However, Ada, in at least two aspects, expands the set of capabilities standard for modern languages. First, Ada provides high-level programming tools for asynchronous processes. Secondly, it is the only language that can be called modular without any reservations.

Such an example is simply necessary in order to refute the rather widespread myth that Ada is a large, complex and "heavy" language, suitable only for writing super-large and super-complex systems. In fact, Ada can be used to develop small and medium-sized programs with the same success as modern clones of C, Pascal, BASIC and Java. For example, a classic example of the "Hello, World!" looks like this in Ada:

It is easy to see that the Ada code is similar to the Pascal code that was chosen as its prototype. The first line describes the relationship of this compiled module with other modules - it is indicated that the Hello_World subroutine should be compiled together with the Ada.Text_IO module, which is a component of the predefined library.

The following program defines two asynchronous processes:

The Local Declarations section of the Tasking_Example procedure describes the Outputter task (line 6, lines 8 through 17 contain the body of this task). When control in the process corresponding to Tasking_Example reaches line 20, before executing this first statement, the process corresponding to the Outputter is started, after which the two processes live and execute asynchronously independently of each other. The execution of the delay statement (lines 14 and 20) consists in suspending the corresponding process for the specified number of seconds. Thus, the Tasking_Example process is suspended for 20 seconds, while the Outputter process starts printing the values ​​of the incrementing counter, pausing for one second after each value is output. After 20 seconds, the Tasking_Example process sets the Finished flag to true, which ends the loop in the Outputter process. Specifying the Finished variable as an atomic data object (line 4) makes it impossible to read and change the value of this variable at the same time.

The following is a template for a function that allows component-wise addition of two one-dimensional arrays. This template can be configured for an arbitrary type, which is a one-dimensional array, for whose components assignment and addition operations are defined ("addition" does not have to be arithmetic addition).

Lines 1-6 contain the declaration of the custom function, and lines 8-20 contain its body. Informally, the tuning parameter is an arbitrary one-dimensional regular type with an unspecified index range (line 4), about which it is only known that its component type is arbitrary, however, an assignment operation is defined for the components (line 2), the index type is arbitrary discrete (line 4) ... Since we have to add two arrays componentwise, we need to know what the addition operation is for the component type. Since this is an arbitrary type, we are forced to pass addition for the component type as a formal preference (line 5).

In the body of the function, we first check whether the lengths of the operands are the same (line 12), otherwise component-wise addition is meaningless. Matching the lengths of the operands does not guarantee that the index ranges will match, so in a loop over the index range of the first argument (line 15), we need to calculate the index of the corresponding component of the second argument each time. We are deprived of the opportunity to do this for the Index type, since we only know about it that it is discrete, so we pass from the value of the discrete type to its ordinal number (the? Pos attribute), calculate the necessary shift for the ordinal number, and return to the corresponding value of the Index type ( the? Val attribute).

Note that the parameters of the (custom) function "+" Left and Right are declared to be of type Arr, the index range of which is not specified. However, Left and Right are formal parameters, in their place, when calling (the result of instantiation) of the "+" function, concrete arrays with known index ranges will be substituted. In the body of the "+" function, we use array attributes (? Range,? First,? Length) to get information about its index range from the object.

Why Ada?

Choosing a language for a software project was previously a purely technical issue. Today it has become a matter of strategic importance with far-reaching implications for the success of the project. Let's list some of the reasons due to which the Ada language was chosen for the implementation of software projects. various companies, or made mandatory for use in tenders.

  • The desire to improve the reliability of the system being developed, since software defects can have serious consequences for human health, economy, ecology, etc. (Ada has built-in security features.)
  • Desire to reduce the cost of developing and maintaining the system.
  • Availability of international standards and availability of language compilers for almost any platform.
  • The benefits of a disciplined approach to software development, which become especially significant as the volume and complexity of software increases.
Ada and C

When conducting comparative analyzes of popular languages, so many copies were broken that today this topic is often referred to the category of "religious wars". Therefore, we will confine ourselves only to a reference to a well-known article, which draws a number of eloquent conclusions.

  1. Development of programs in the Ada language costs 60% less than similar software projects implemented in C.
  2. An Ada program has 9 times fewer defects than a C program; a C ++ program has even lower characteristics than a C program.
  3. preferable to C for both experienced and inexperienced programmers, as well as for programmers who have both the maximum and minimum ratings in their group.
  4. The complexity of studying the language of Hell is not higher than the complexity of studying C.
  5. Ada programs are more reliable than C programs.

As an illustration of these conclusions, we will give an example of the development of onboard software for a C-130J aircraft in accordance with the requirements of Level A of the DO-178B standard. At the same time, the quality of the code was stated to be 10 times higher than the average for Level A software. Labor productivity quadrupled relative to comparable software projects.

Ada and Java

Microsoft was forced to include in licensing agreements for their operating systems next item ( www.microsoft.com/msdownload/ieplatform/ie/ license.txt): “Java language support note ... Java technology is not fault tolerant and is not intended ... for use in real-time control systems ... where Java language failure could result in death, injury, or severe damage to infrastructure or the environment. Sun Microsystems, Inc. obliged Microsoft to post this warning. "

Let us also point out articles and, demonstrating the advantages of the Ada language over Java.

"Infernal" myths

Quite often, a set of persistent misconceptions is associated with Ada that impede both the spread of the language and the conscious choice of Ada as the language for project implementation.

Ada is a dead language, no one programs in it now. In fact, Ada confidently occupies the niche of large embedded systems with increased reliability requirements. Compared to "box" products for Windows, such systems are not so noticeable, because they either exist in one copy (what's the point of replicating the program that controls the movement of subway trains), or distributed as part of the system in which they are embedded (onboard software).

Ada is a language designed exclusively for military applications. Ada was indeed developed with the assistance of the US Department of Defense, but there are no technical, administrative or other reasons preventing the use of Ada for the development of civilian systems. The number of "civilian" projects based on this language today is comparable to the number of "military" projects.

Ada is too large and complex a language to use in a small project. The volume and complexity of all modern industrial languages ​​is almost the same, and to be sure of this, it is enough to simply compare the volume of their descriptions. This myth dates back to the early 1980s, when Ada was compared to Pascal, Fortran 77 or BASIC.

There are few programmers who know Ada; learning a language from scratch requires excessive effort and time. In fact, the real difficulty is finding specialists who understand the specifics of embedded systems and are able to create high-quality programs for them. For example, BAE, one of the active users of the Ada language, does not require candidates to know this language; instead, people familiar with embedded systems and industrial-quality software creation processes are sought. After hiring such people, it only takes two weeks to teach them the language of Hell.

Our personal experience shows that programmers familiar with this or that form of Pascal only take a few days to start developing simple programs in Ada.

The existing Ada technologies are ineffective; both translators and the code they generate have poor performance. This myth also dates back to the first half of the 80s, when the first implementations of Ada appeared, in fact, just proving "the theorem of existence of the Hell-translator corresponding to the standard." It is enough to carry out a number of simple experiments by programming some model problem in Ada, Pascal and C / C ++, and then comparing (with comparable compiler parameters) the compilation speed, the amount of generated code and the speed of its execution to make sure that any specific inefficiency inherent in Hell simply does not exist. It can also be noted that the GNAT programming system, with a source code volume of more than 40 MB, is 90% implemented in Ada, and its construction from source codes (in its course it compiles itself three times) on a modern PC takes no more than half an hour.

Ada's existing implementations are extremely expensive. This is true, however, it should be borne in mind that there is a publicly available version of the GNAT programming system, which can be freely and legally taken from the software repository of New York University ( ftp://cs.nyu.edu/pub/gnat) together with source texts

Free cheese and how to avoid the mousetrap

GNAT (GNu Ada Translator) is a multi-platform implementation of the Ada language that exists on almost all modern industrial platforms and supports code generation for popular embedded architectures. GNAT ( www.gnat.com) fully implements the Ada standard, including those libraries that are classified as optional by the standard. In addition to the HADA translator itself, GNAT includes a toolkit, in which it should be noted an advanced integrated development environment and a multilingual graphical debugger, which allows, among other things, to investigate the behavior of programs with asynchronous processes. The translator and accompanying tools can be used both separately, calling them from the command line, and within the framework of the integrated graphical development environment for Ada programs. All GNAT components, including the development environment, have the same interface across all platforms. In addition to fully implementing the features described by the standard, GNAT offers a rich set of extensions that the standard allows. GNAT is an implementation of Ada in the gcc multilingual programming system, which consists of a set of front-end compilers for different input languages ​​with a common code generator, which greatly simplifies the development of programs containing components implemented in different programming languages.

GNAT was developed and distributed from the beginning under the GPL license. Alas, there are many myths associated with the GPL. For example, many people think that GPL-covered programs are developed by unorganized groups of enthusiasts and are distributed absolutely free of charge; as a result, both reliability and functionality of such programs leave much to be desired, do not allow them to be used in any serious projects. This is far from the case with GNAT. In order to be convinced of this, it is enough to look at the list of companies that have entered into contracts with its developers for technical support: Boeing, British Aerospace, Lockheed, Ericsson, SAAB, Avionics, etc.

Free provision demos is a common practice for many software developers. GNAT differs in that the freely available public version is absolutely full version technology, without any legal or technical restrictions on its use. A number of serious projects have been successfully implemented on the basis of public versions of GNAT. The software of the lander Beagle 2 of the European automatic station Mars Express, bound for this moment to Mars ( www.beagle2.com/index.htm), automated station of documentary communication of the Ministry of Defense of the Russian Federation ( www.ada-ru.org/prj_doc.html). The only drawback of public versions is that the developer does not provide technical support for them.

Conclusion

To summarize, the Ada language provides developers with the perfect combination of integrity, consistency, reliability, and efficiency. The language supports creative creativity and innovation, while providing the discipline and industrial level of software development necessary to implement software systems of great importance.

Literature
  1. Benjamin Brosgol, Introduction to Ada 95. www.embedded.com/story/OEG20021211S0034
  2. Stephen Zeigler, Comparing Development Costs of C and Ada. www.adaic.com/whyada/ada-vs-c/cada_art.html www.ada-ru.org... An annotated bibliography of books on the language of Hell, published in Russian, can be found on the website

High-level, focused on application in real-time systems and designed to automate the tasks of controlling processes and / or devices, for example, in on-board (ship, aviation) computers.

The Ada language was developed at the initiative of the US Department of Defense in the 1980s, and is named after the mathematician Ada Augusta Lovelace (1815-1851). When designing the language, first of all, attention was focused on reliability and efficiency - the language was created specifically for the development of large real-time software systems for embedded systems, to which high reliability requirements are imposed; first of all, these are military systems.
The Ada language is based on the ideas of structured programming and provides the development of complex multi-module programs, a high degree of machine independence and portability. Ada contains the capabilities of Pascal-like languages ​​such as type definitions, common control structures and subroutines, and the advances in programming language theory since 1970. The language supports logical modularity, for which data, types, and subroutines can all be packages. Physical modularity is achieved by compiling separately. The Ada language supports real-time programming through parallelism and exception handling mechanisms. System programming is supported by access to system-dependent parameters and precision control of data presentation.

By 1974, many different programming languages ​​were in use within the US Department of Defense. This increased the time and money spent on the development of new systems and on the technical retraining of personnel. The heads of the ministry came to the conclusion that it is necessary to use a single programming language. In 1975, a list of requirements for such a language was agreed. None of the programming languages ​​that existed at that time (such as Pascal, ALGOL-68 or PL / 1) met the requirements. Therefore, in 1977, it was decided to create a new language, and a competition was announced for its development. Of all the proposals, four were selected (each of which was an extension of Pascal), for subsequent revision and refinement. Later, for further clarification, two of them were selected, and in the final they chose a project presented by Cii-Honeywell Bull. This language was given the name Ada (originally the language was called DOD-1).

In 1983, the ANSI / MIL-STD-1815A language standard was adopted, and in 1987 - the international ISO 8652 standard. In 1987, the first effective Ada translators appeared. The ISO standard was revised in early 1995 (ANSI / ISO / IEC 8652). The new standard fixed many of the omissions and shortcomings of the original language, and supplemented it with many new useful properties, such as procedural types, based pointer types (that is, pointers to non-dynamic objects), hierarchical libraries, additional concurrency controls, many standard libraries... In addition, in Ada-95 there was support for object-oriented programming.
The next standard was given the informal name Ada-2005, although it had not yet been adopted in 2005. The Ada community decided to move away from the tradition of informally naming the standard by the year of publication, since in 2005 all its main parameters were agreed. The language adds multiple inheritance, a prefixed form of access to object methods, more flexible reference types, improved task management, and a large number of new standard libraries. In addition, Ada-2005 complies with the ISO / IEC 10646 (2003) standard, which allows using the letters of the Russian and Greek alphabets in the names of identifiers (names of variables, functions).
Ada is considered the common programming language for both the US military and NATO.

In addition, Ada is used to build large systems to which high reliability requirements are imposed, such as: computer systems for aviation (including civil); control computer systems for high-speed railways; banking systems; industrial automation and robotics; Medical equipment; telecommunication systems.

Ada is used in higher educational institutions in the USA and Western Europe, as a basis for the study of programming, and is often used in research and development. Ada-program manages the movement of trains without drivers in the Paris Metro. A number of firms specialize in the development of compilers, various libraries and tools, covering a wide range of hardware platforms and operating systems. In addition to commercial development tools, there are freely available compiler versions such as ObjectAda from Aonix or GNAT from Ada Core Technologies.

Ada is the most standardized programming language. The international standard was adopted before the first working versions of translators appeared, thus avoiding the incompatibility of the various dialects of Ada. Ada surpasses SI and C ++ in terms of the rigor of data typing, the flexibility of separate compilation, the ability to create highly reliable real-time systems, the availability of strict control over function parameters and index overruns (80% of errors that occur when creating programs in C / C ++ are related to with this) and machine-independent representation of binary values ​​(instead of bit operations, the retrieval of record fields is performed). At the same time, Ada is semantically and syntactically transparent, so it is easier to learn it than Java.

Ada is inferior to C / C ++ in support of new operating systems, as well as in the availability of maintenance, debugging and shaping tools graphical interfaces... But the language standard includes automatically generated specifications for interfacing with other programming languages, and in practice, Fortran mathematical libraries, system functions written in C, Java classes for working with the Internet are used together with Ada. Therefore, there are multilingual IDEs that support languages ​​other than Ada, for example, IBM Rational Ada Developer (C / C ++ / Ada).

Ada implements both automatic garbage collection (as in Java or C #) and the ability to reclaim memory directly (as in C, C ++, Pascal). As with C / C ++, Ada has rich low-level facilities available. Built-in multitasking support is unique to the Ada programming language and sets it apart from most programming languages. This support is not provided by extensions or external libraries, but by standardized tools that are built directly into the programming language.

(Ada 2005), Eiffel (Ada 2012)

C ++, Chapel, "Drago". , Eiffel, Griffin. , Java, Nim, parachute behind a boat, PL / SQL, PL / PgSQL, Ruby, Seed7, "SPARforte". , Sparkel, SQL / PSM, VHDL

Features of Ada include: strong typing, modularity mechanisms (packages), runtime validation, parallel processing (tasks, synchronous message passing, protected objects, and non-deterministic select statements), exception handling, and generics. Ada 95 added support for object-oriented programming, including dynamic dispatch.

Ada syntax minimizes the choice of how to perform basic operations, and prefers English keywords(for example, "or" and "and then") to symbols (such as "||" and "&&"). Ada uses the basic arithmetic operators +, -, *, and /, but avoids using other characters. Blocks of code are delimited by words such as "declare", "start" and "end", where "end" (in most cases) follows the identifier of the block it closes (for example, if end, if ... , loop ... end of loop). In the case of conditional blocks, this avoids torn off still, which can pair with invalid nested if statements in other languages ​​such as C or Java.

Ada is designed for the development of very large software systems. Ada packages can be compiled separately. Ada package specifications (package interface) can also be compiled separately without checking for compliance. This allows problems to be detected early in the design phase, before implementation begins.

A large number of compile-time checks are supported to help avoid bugs that will not be detected until runtime in some other languages, or that require explicit checks to be added to the source code. For example, the syntax requires the explicit name of block closures to prevent errors due to mismatched trailing markers. Strong typing can detect the presence of standard software errors (bad parameters, range violations, invalid references, mismatched types, and so on) either at compile time or otherwise at run time. As concurrency is part of the language specification, the compiler may in some cases detect potential dead ends. Compilers also routinely check for spelling errors for identifiers, package visibility, redundant declarations, etc., and can provide warnings and helpful hints on how to fix the error.

Ada also supports runtime checks to protect against unallocated memory access, buffer overflow errors, range violations, out-of-band errors, array access errors, and other detectable errors. These checks can be disabled in the interest of performance efficiency, but can often be collected efficiently. It also includes tools to help validate the program. For these reasons, Ada is widely used in critical systems where any anomaly can lead to very serious consequences, such as death from an accident, injury or severe financial loss. Examples of systems that use Ada include avionics, ATC, railways, banking, military and space technology.

Ada's dynamic memory management is high level and type-safe. Ada has no generic or untyped pointers; and implicitly declare any pointer type. Instead, all dynamic memory allocation and deallocation must occur through the explicitly declared access types... Each type of access has a corresponding storage pool which handles the low-level details of memory management; the programmer can either use the default storage pool or define new ones (this is especially true for Non-Uniform Memory Access). You can even declare several different types access, which all denote the same type, but use different storage pools. In addition, the language provides availability of checks, both at compile time and at run time, which ensures that access cost cannot erase the type of object it points to.

Although the semantics of the language allows automatic garbage collection of inaccessible objects, most implementations do not support it by default, as this would lead to unpredictable behavior on real-time systems. Ada maintains a limited region shape based on memory management; In addition, creative use of storage pools can provide a limited form of automatic garbage collection because destroying a storage pool also destroys all objects in the pool.

history

Work continues to improve and update the technical content of the Ada programming language. A technical fix for Ada 95 was published in October 2001, and a major amendment, ISO / IEC 8652: 1995 / Amd 1: 2007, was published on March 9, 2007 At the Ada-Europe 2012 conference in Stockholm, the Ada Resources Association (ARA) and Ad -Europe announced the completion of the design latest version the Ada programming language and submitting the reference manual to the International Organization for Standardization (ISO) for approval. ISO / IEC 8652: 2012 was published in December 2012.

Other relevant standards include ISO 8651-3: 1988 Information processing systems, computer graphics, graphics system core (GKS) binding language - Part 3: Ada .

Language constructs

"Hello World!" in Ada

A typical example of such a language in syntax is Hello world program: (hello.adb)

with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line ("Hello, world!"); end Hello;

This program can be compiled using the free open source GNAT compiler by running

gnatmake hello.adb

Data types

Ada's type system is not based on a set of predefined primitive types, but allows users to declare their own types. This statement, in turn, is not based on the internal representation of the type, but on a description of the goal that must be achieved. This allows the compiler to determine the appropriate memory size for a given type, and to check for compile-time and run-time type inference violations (i.e., range violation, buffer overflow, type consistency, etc.). Ada supports numeric types defined in range, modulo types, aggregate types (records and arrays), and enumeration types. Access types define a reference to an instance of the specified type; untyped pointers are not allowed. Special types provided in the problem type language and protected views.

For example, a date can be represented as:

type Day_type is range 1 .. 31; type Month_type is range 1 .. 12; type Year_type is range 1800 .. 2100; type Hours is mod 24; type Weekday is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); type Date is record Day: Day_type; Month: Month_type; Year: Year_type; end record;

Types can be qualified by declaring subtypes:

subtype Working_Hours is Hours range 0 .. 12; - at most 12 Hours to work a day subtype Working_Day is Weekday range Monday .. Friday; - Days to work Work_Load: constant array (Working_Day) of Working_Hours - implicit type declaration: = (Friday => 6, Monday => 4, others => 10); - lookup table for working hours with initialization

Types can have modifiers such as limited, abstract, private etc. Private types can be accessed and restricted types can only be modified or copied within the package that defines them only. Ada 95 adds additional features for object-oriented type extension.

Control Structures

Ada also offers protected objects for mutual exclusion. Protected objects are monitor-like constructs, but use protective instead of conditional variables for signaling (similar to conditional critical areas). Guarded facilities combine data encapsulation and secure mutual exclusion from monitors, as well as security entry guards from conditional critical areas. The main advantage over classic monitors is that conditional variables are not required for signaling, avoiding potential deadlocks due to incorrect locking semantics. Like tasks, the securable is a built-in bounded type, and it also has a part and body declaration.

The protected object consists of encapsulated personal data (which can only be accessed within the protected object), as well as procedures, functions and records that are guaranteed to be mutually exclusive (with the only exception of functions that are necessary to be a side effect free of charge. Thus, and can work simultaneously with other functions). The task of invoking a securable object is blocked if another task is currently executing in the same securable, and is released when that other task leaves the securable. Blocked tasks are queued at the protected object at the ordered arrival time.

Protected object data are similar to procedures, but additionally have protection... If the guard evaluates to false, the challenge task is blocked and added to this entry's queue; Now another task can be admitted to the securable object, since none of the tasks is currently being executed inside the securable object. The guards are reevaluated whenever a task leaves the guarded facility, as this is the only time the guards' rating can be changed.

Recording calls can be requeued for other records with the same signature. The task that is requeued is blocked and added to the target record queue; this means that the securable object is released and allows another task to be accepted.

Please select the operator in Ada can be used to implement non-blocking entry calls and accepts, non-deterministic record selection (also guarded), time-out and aborts.

The following example illustrates some of the concurrent programming concepts in Ada.

with Ada.Text_IO; use Ada.Text_IO; procedure Traffic is type Airplane_ID is range 1.. ten ; - 10 airplanes task type Airplane (ID: Airplane_ID); - task representing airplanes, with ID as initialisation parameter type Airplane_Access is access Airplane; - reference type to Airplane protected type Runway is - the shared runway (protected to allow concurrent access) entry Assign_Aircraft (ID: Airplane_ID); - all entries are guaranteed mutually exclusive entry Cleared_Runway (ID: Airplane_ID); entry Wait_For_Clear; private Clear: Boolean: = True; - protected private data - generally more than just a flag ... end Runway; type Runway_Access is access all Runway; - the air traffic controller task takes requests for takeoff and landing task type Controller (My_Runway: Runway_Access) is - task entries for synchronous message passing entry Request_Takeoff (ID: in Airplane_ID; Takeoff: out Runway_Access); entry Request_Approach (ID: in Airplane_ID; Approach: out Runway_Access); end Controller; - allocation of instances Runway1: aliased Runway; - instantiate a runway Controller1: Controller (Runway1 "Access); - and a controller to manage it ------ the implementations of the above types ------ protected body Runway is entry Assign_Aircraft (ID: Airplane_ID) when Clear is - the entry guard - calling tasks are blocked until the condition is true begin Clear: = False; Put_Line (Airplane_ID "Image (ID) &" on runway "); end; entry Cleared_Runway (ID: Airplane_ID) when not Clear is begin Clear: = True; Put_Line (Airplane_ID" Image (ID) & "cleared runway"); end; entry Wait_For_Clear when Clear is begin null; - no need to do anything here - a task can only enter if "Clear" is true end; end Runway; task body Controller is begin loop My_Runway. Wait_For_Clear; - wait until runway is available (blocking call) select - wait for two types of requests (whichever is runnable first) when Request_Approach "count = 0 => - guard statement - only accept if there are no tasks queuing on Request_Approach accept Request_Takeoff (ID: in Airplane_ID; Takeoff: out Runway_Access) do - start of synchronized part My_Runway. Assign_Aircraft (ID); - reserve runway (potentially blocking call if protected object busy or entry guard false) Takeoff: = My_Runway; - assign "out" parameter value to tell airplane which runway end Request_Takeoff; - end of the synchronized part or accept Request_Approach (ID: in Airplane_ID; Approach: out Runway_Access) do My_Runway. Assign_Aircraft (ID); Approach: = My_Runway; end Request_Approach; or - terminate if no tasks left who could call terminate; end select; end loop; end; task body Airplane is Rwy: Runway_Access; begin Controller1. Request_Takeoff (ID, Rwy); - This call blocks until Controller task accepts and completes the accept block Put_Line (Airplane_ID "Image (ID) &" taking off ... "); delay 2.0; Rwy. Cleared_Runway (ID); - call will not block as "Clear" in Rwy is now false and no other tasks should be inside protected object delay 5.0; - fly around a bit ... loop select - try to request a runway Controller1. Request_Approach (ID, Rwy); - this is a blocking call - will run on controller reaching accept block and return on completion exit; - if call returned we "re clear for landing - leave select block and proceed ... or delay 3.0; - timeout - if no answer in 3 seconds, do something else (everything in following block) Put_Line (Airplane_ID "Image (ID) &" in holding pattern "); - simply print a message end select; end loop; delay 4.0; - do landing approach ... Put_Line (Airplane_ID" Image (ID) & "touched down! "); Rwy. Cleared_Runway (ID); - notify runway that we "re done here. end; New_Airplane: Airplane_Access; begin for I in Airplane_ID "Range loop - create a few airplane tasks New_Airplane: = new Airplane (I); - will start running directly after creation delay 4.0; end loop; end Traffic;

Pragmas

A pragma is a compiler directive that passes information to the compiler to allow specific manipulation of the compiled output. Some pseudo-comments are built into the language, while others are implementations.

Examples of common compiler use of pragmas would disable certain features, such as runtime type checking or array index boundary checking, or instruct the compiler to insert object code instead of calling a function (in C / C ++ it does with inline functions).

  • APSE - Specification for a programming environment to support software development in Ada
  • Ravenscar Profile is a subset of Ada multitasking features designed to secure critical hard real-time computing
  • SPARK (programming language) - a programming language consisting of a very limited subset of Ada, annotated with meta information describing the desired behavior of the component and individual requirements at runtime