Cooking with Linux - Scalability: from Simplicity Comes Complexity
It's a methanol molecule, François. Why do you ask? Non, mon ami, it may be alcohol, but it bears no resemblance to the alcohol found in that most noble of liquids, wine. That would be ethyl alcohol, and as you can see, its molecular structure is quite different. Why am I doing this, you ask? Because the theme of this issue is kernel scalability. You still do not see the connection? Kernel scalability, François, is a fascinating area of development. This is the front line of Linux's future, and the programmers working in this area are doing fantastic work. It just seemed to me that because we are going to be sampling a little bit of wine when our guests arrive, a different kind of scalability might be in order. François, why aren't you paying attention?
Ah, our guests are here! Welcome, mes amis, to Chez Marcel, home of fine Linux fare, exceptional wines and from-the-ground-up design. François and I were discussing the theme of this issue. Please sit; your tables are ready and my faithful waiter will run to the cellar immédiatement to fetch the wine. I think the 2001 Châteauneuf-du-Pape with its rich fruit, tantalizing texture and complex aromas should do nicely. You'll find it in the south wing next to the entrance to the reading room.
While we wait for the wine, let me introduce you to the first item on today's menu. As I was telling François, I felt that because we are sampling a little vin, our features would explore scalability of a different sort. Just as a few lines of code can have a huge impact on the performance of certain kernel functions, so too can a few stray atoms have a massive effect on a final molecular product. For instance, consider the difference between ethyl alcohol and methanol. Most of us left chemistry behind a number of years ago, with the possible exception of cooking, non? As part of the KDE suite, you can find a little program from Andreas Wst called KAtomic (Figure 1). It is listed under the Games menu along with other strategy or puzzle games.
If you ever have played Sokoban, you should notice some similarities here. The premise of KAtomic is simple. Execution is somewhat more complex. You are given a molecule, displayed in the right-hand pane, with its component atoms scattered in a maze of sorts. Pressing the Tab key (or clicking the mouse) selects an atom that you then set in motion by pressing one of the cursor keys. Once in motion, the atom continues to move until it hits a barrier, either a wall or another atom. In this way, you create complexity from simplicity. It's also a fantastic way to eat up your free time.
Just as simple code is used to build ever more complex programs, so too can we move from molecules to visible structures. The next item on tonight's menu is a little hard to explain, and I must admit that I had some doubts when I first looked at it. It's called Construo, and quite frankly, it turned out to be an amazingly addictive little program.
Ingo Ruhnke's Construo is, in effect, a two-dimensional construction program that lets you build objects on-screen using rods and springs connected at points that you define. The resulting structure then can be run, which essentially means letting real-world physical forces act on it. The idea is to build a stable structure, which is a lot harder than it sounds. If your creation starts to waver and finally crashes to the ground, it's time to rethink and modify your construction. A note on the Construo Web site makes a point of letting us know it is “currently not a real game”, but I beg to differ. To get in on this thought-provoking bit of fun, head over to the Construo Web site at www.nongnu.org/construo.
Building Construo simply is a matter of extracting, configuring and making. Yes, mes amis, it's the classic extract and build five-step:
tar -xzvf construo-0.2.2.tar.gz cd construo-0.2.2 ./configure make su -c "make install"
Running make install installs the program in /usr/local/games. In that directory, you may find two versions of the program, one called construo.x11 and the other called construo.glut. On the SuSE 8.2 notebook where I tested Construo, I found the graphics to be sharper and the text cleaner when using the X11 version (Figure 2).
When the program starts for the first time, you are presented with a clean slate. At the top of the program window, you see some keyboard shortcuts. To the right and left are control buttons. If you abandon a design halfway when you quit, Construo returns you to that design the next time you play. If, like François, the idea of starting clean intimidates you, click the Load button and navigate to the Examples directory. There, you are rewarded with a number of prebuilt structures you can modify until you feel more confident to create from scratch.
To add a dot, left-click on the screen, move to where you want the opposite point (or joint) to reside and left-click again. To remove a dot, right-click. At some point, you should feel you've created something reasonably stable. Click the Run button to set the laws of physics into motion, and watch how your structure behaves under stress. In all likelihood, your first creation will bend, twist, topple and eventually collapse—which can be a lot of fun. Construo lets you set objects in motion (check out the basketball demo), put barriers in the way (colliders) and otherwise release your creative genius.
To modify and strengthen your now—demolished creation, click Undo and your whatever-it-is (or was) returns to its former glory. When you get bored with creating and are ready to start anew, press C to clear the scene, and you once again begin your mechanical ascent to new heights.
Building things on solid ground is interesting enough, but try building them in a 3-D, zero gravity, virtual world. That's the idea behind one of the strangest games this Linux chef has ever run across. The program, called Ensemblist, was created for a 2003 Paris game-coding exhibit. This is another one of those deceptively simple ideas that turns out to be something much greater. All you have to do is build the shape presented to you on-screen using simple geometric shapes. This assembly uses simple programming and mathematical principles: boolean, union and intersection.
Have I neglected to mention that the shapes are three-dimensional and floating in a networked virtual space where they can be rotated along any axis? This is something the authors, rixed and dom, call CSG, or constructive solid geometry (Figure 3).
Ensemblist is distributed as source from www.nongnu.org/ensemblist. After extracting the file with tar -xzvf ensemblist.tgz and switching to the source directory with cd ensemblist, you simply run make. When the compile finishes, type su -c 'make install'. Now, run the program by typing ensemblist at the command line. Ensemblist installs in /usr/local/games by default.
What follows is a bit strange the first time around. The program connects to the Ensemblist Web site, after which you find yourself floating above a flowchart diagram (Figure 4) where you see your user name and your current score (which is 1). Below that intro box are two options, OK and Quit. With your mouse, you can zoom in and out from this landscape by moving the cursor up or down. Click OK and you are transported to the game options, where you can choose free play or select a campaign that takes you through some predefined levels. You probably want to start with a campaign. You also may want to ask François to fill up your wineglass, to steady yourself.
When the game starts, your selected object is presented in the center of a spherical space bounded by fractal walls. Click the Play icon to the lower right and the action begins. On the bottom left-hand corner, a counter ticks away. The objects you need to use to create the final shape are geometric primitives, and they all are sitting at the top left. These are spaced with union operators. Clicking on the union operators selects between union (looks like a U), intersection (an upside-down U) and minus (a minus sign). At the bottom right, new icons appear so that you can review the original shape, quit or claim victory.
That's all there is to it. Move shapes in and out of the central build area according to these simple rules. This also is where you discover how difficult simple can be. Ensemblist is very strange and strangely addictive. On subsequent plays, you can use the --no-net option when starting the game, because the existing levels have been downloaded to your system. Before you click Play next time, take note of the box labeled Editor. Yes, if you feel up to it, you even can create your own levels and help build the Ensemblist universe.
Mon Dieu! It seems that we have managed to come to the end of another evening. Perhaps, inspired by the complex wonders that can result from the application of simple ideas, one of you fine people might turn your talents to building a machine that will give us more time, non? Stretching time certainly would qualify as taking scalability to new heights. Still, there certainly is time for another glass of wine. Relax, finish what you are working on, and François will pour you a final glass. If you are feeling a little too relaxed, it is nice to know that the only height you need to raise your wine to is your lips. A little joke, mes amis. Enjoy! Until next time, mes amis, let us all drink to one another's health. A votre santé Bon appétit!
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
|PostgreSQL, the NoSQL Database||Jan 29, 2015|
|HPC Cluster Grant Accepting Applications!||Jan 28, 2015|
|Sharing Admin Privileges for Many Hosts Securely||Jan 28, 2015|
|Red Hat Enterprise Linux 7.1 beta available on IBM Power Platform||Jan 23, 2015|
|Designing with Linux||Jan 22, 2015|
|Wondershaper—QOS in a Pinch||Jan 21, 2015|
- PostgreSQL, the NoSQL Database
- Sharing Admin Privileges for Many Hosts Securely
- HPC Cluster Grant Accepting Applications!
- Designing with Linux
- Wondershaper—QOS in a Pinch
- Internet of Things Blows Away CES, and it May Be Hunting for YOU Next
- January 2015 Issue of Linux Journal: Security
- Ideal Backups with zbackup
- Red Hat Enterprise Linux 7.1 beta available on IBM Power Platform
- Slow System? iotop Is Your Friend