Montag, 12. Mai 2008

Concurrency in Ada

Ada is renown for its concurrency support. Parallel programming is a difficult
issue in all aspects. It is difficult to learn, to design, to program, to validate, but
for all, it is most difficult to reuse.

Yesterday I finished the version 3.0 of the Simple Components for Ada, where I tried
to summarize my experience and ideas in this area. The library among other things
contains some basic gears for dealing with concurrency.

The section 9 is devoted to implementation of some lock-free data
structures. These become more popular with new multi-core architectures.
Though Ada was not designed to provide lock-free primitives on the low-level,
for that obvious reason that this would be non-portable. It still has necessary
tools. Here I mean the pragma Atomic, which allows many interesting things to do.

The section 10 contains implementations of locking synchronization primitives.
Protected objects introduced in Ada 95 is an excellent mechanism of a great
power. Especially interesting is to explore the requeue statement. Events,
pulse events, arrays of events, mutexes, arrays of mutexes let be implemented
as protected objects. Using the requeue statement one can do a lot of things,
which appear impossible at the first glance. For example, this section
presents a programming pattern for using entry parameters in the barriers of.
It also discusses how race condition and deadlocks can be avoided when using
protected objects.

Two classical problems are considered on examples: the checkpoint
synchronization problem, and the dining philosophers one.

It is free as only it can be, the license is GMGPL I hope you will enjoy it.

http://www.dmitry-kazakov.de/ada/components.htm

Dienstag, 22. Januar 2008

Why I hate Gtk+/GNOME

I never liked Gtk+/GNOME all that much - but as an Ada supporter I learned to hate them.

Currently I try to create GtkAda for MinGW - from scratch. I already did so for Solaris so I have a fairly good idea what I am in for – only for MinGW everything is even more tricky.

The largest problem huge amount of dependencies in Gtk+ – see the Partner Projects page of The GNU Ada Project for details. Note that the list is never quite complete.

On Solaris I only hat to upgrade parts of Gtk+. But in MinGW I have nothing to build on and need to start from scratch. And with the very first package I run into an complete blocker which puts a interesting new angle to the "The Henn and Egg problem" problem I described a few days ago:

Glib2 needs Pkg-Config to compile and Pkg-Config uses the Glib2 library. And no "--without" or "--disable" configure options to be seen.

I googled the internet high an low without any hint whatsoever on how to break the recursive dependency. As it is it seems that it is impossible to bootstrap Gtk+ at all.

Now, one might argue that this is a developer problem and developers should be used to grieve. But that is not the way it works. Such flaky design will show in the final product as well. I for once have disabled the "GNOME stable" download channel for openSUSE long ago and with no desire for reactivation. It left me quite a few time with an unusable system. The problem was – guess what – faulty dependencies.

Montag, 21. Januar 2008

The Henn and Egg problem

Over time I have created GNAT compiler for a variety for of platforms and one thing I noticed is the constant encounter of Hen and Egg situation. — At least when you leave the save heaven of Linux. Below some examples:

Texinfo and libiconv

A classic one: The compiler needs Texinfo to create it's online help and you need an working compiler to create Texinfo. Ahh, and Texinfo needs libiconv and libiconv needs a working C++ compiler.

But these problems is easily solved since online help is only optional extra.

Buinutils

Similar to Texinfo only a little trickier as a working assembler and linker are an absolute must. And don't expect every platform to come with a sufficiently up-to-date assembler or linker — Solaris springs to my mind here.

C++

C++ is an integral part of GCC compiler and needed by libiconv. But that is not the problem. The problem is that the C++ build expect the C header file to exist at prefix/include. Of course they only exist there after make install.

Ada

For us Ada users the worse one: Ada is self hosted. Being self hosted is of course very cool indeed: About 95% of the Ada compiler and runtime are written in Ada. I do pity the poor GNU-Fortran maintainer where most of the compiler and runtime is written on C — Yuck.

Of course that coolness comes for a price: You need a working Ada compiler to build the Ada compiler.

Resume

Why am I telling you all that? Now, if you are planning to build a newer compiler / tool chain for any platform apart from an up to date Linux you should – from the very onset – expect to build the compiler more then once. In fact: plan for 3 to 4 successful iterations (and an uncounted amount of unsuccessful iterations). Start off with just C and Ada, add other languages later. Don't worry if for example Texinfo is reported to old, Create a newer version later and try again. And remember that libiconv needs an up to date C++ compiler.

Mittwoch, 9. Januar 2008

The Fundamental Theory of Ada

Another great article from Marc. After the recent discussion on /. and reddit it's well worth reading so one actually knows what Ada is all about.

Go ahead have a look.

read more | digg story | discuss at reddit

"Picking the Right Tool" is a Tautology

Marc comments that when choosing the right tool one should consider Political, Operational, Economic, and Technology (POET) - however in current times Technology is considered less and less just leaving us with "POE".

And indeed the main arguments I hear against Ada is not that it is bad technology but that Ada is dead (Political) or that it is difficult to get skilled Ada programmers (Operational). Yes you (computing) world is in a sad state of affairs.

read more | digg story | discuss at reddit

Sonntag, 6. Januar 2008

TIOBE January 2008

A new Month - a new TIOBE Programming Community Index and Ada percentage is slashed by half. But Ada is not the only none - several other languages in the lower half had there percentage reduced.

Not a surprise as well. Last month on comp.lang.ada I observed that all the top 20 (and 21) languages are now considered main stream - by TIOBE's very own rules. That defeated the object and something had to change and did change - but what?

While the percentage was slashed the relative position of Ada is gone up by one place to 23. But that is still not the top 20 and behind "ActionScript", "ColdFusion" and "Logo".

And a mystery has been solved: Why Lua is so successful! It's the scripting Language used to write World of Warcraft add-ons - We can't beat that! No joking here: The index is about how often a programming language is mentioned in a forum, blog etc. pp. and there a 8.5 million active players looking for a way to pep up there favorite game. If there are at all successful in writing an add-on is a different story.

Martin