The OOM killer is a tough nut to crack. How can a system recover when it's violently thrashing and out of RAM? Once upon a time, you'd just have to reboot. And today, that still might be necessary, but less so, because the OOM killer attempts to identify and stop the process that seems to be causing the hangup. The problem is, it may not choose the right process every time. Another problem is that the whole thing is super tough and complex.
Michal Hocko recently tried to peel off a sliver to work on, taking the lead from Mel Gorman and Oleg Nesterov. Apparently, the current OOM killer would allocate an extra batch of memory just for the process it wanted to kill to actually give it enough breathing room to terminate properly. But under some circumstances, the process would accept the extra memory and still hang the system. Then with no more memory to dole out, the OOM killed couldn't try again, and it was time to hit the reset button.
Michal posted a patch to create a new kernel thread that would reclaim that extra memory if it went unused. Then the OOM killer could try the same thing on a different process and hopefully have a different result. And although there were no major objections to Michal's patch itself, a variety of folks objected to the idea of making any kind of incremental improvement to the OOM killer, when the Big Problem had not yet been solved.
The Big Problem, as described by Johannes Weiner, was how to resolve memory deadlocks in general. Only by solving that problem could the OOM killer successfully kill the processes it needed to, even to the point of killing all user processes, just to keep the kernel up.
But, Michal made a point of keeping the discussion clamped down to a consideration of only the small fixes he'd proposed. He acknowledged that he had no solution for the Big Problem, and he pointed out that no one else seemed to have a viable solution for the Big Problem either. And until something viable came up, Michal saw no point in stalling OOM killer development. If something could be done to improve it, he felt, then it should be done.
By and large everyone went along with this, but still, it's clear there's a lot of pressure on the OOM killer system to come up with some kind of new idea or at least to create a policy-based system that puts control of the choices of processes to kill into the hands of system administrators rather than the kernel algorithms themselves.
Linus Torvalds had some advice for anyone writing kernel code that needs to lock resources: it's probably better to use existing locking implementations rather than rolling your own—at least, until you know what you're doing. As he put it:
People need to realize that locking is harder than they think, and not cook up their own lock primitives using things like trylock without really thinking about it a lot.
Basically, trylock() on its own should never be used in a loop. The main use for trylock should be one of:
1) Thing that you can just not do at all if you can't get the lock.
2) Avoiding ABBA deadlocks: if you have an A->B locking order, but you already hold B, instead of “drop B, then take A and B in the right order”, you may decide first to trylock(A), and if that fails, you then fall back on the “drop and relock in the right order”.
But if what you want to create is a “get lock using trylock”, you need to be very aware of the cache coherency traffic issue at least.
It is possible that we should think about trying to introduce a new primitive for that loop_try_lock() thing. But it's probably not common enough to be worth it—we've had this issue before, but I think it's a “once every couple of years” kind of thing rather than anything that we need to worry about.
The “locking is hard” issue is very real, though. We've traditionally had a lot of code that tried to do its own locking, and not getting the memory ordering right, etc. Things that happen to work on x86 but don't on other architectures, etc.
The biggest problem I have with gaming is that it takes far too long to get “into” games. I'm generally very busy, and my gaming time usually lasts as long as it takes for the dentist to call me in from the waiting room (or possibly how long it takes me to use the bathroom, but eiw, let's not go there). For me, the perfect game can be fun even if I can play only for a few minutes. It also has to be very quick to learn, because “learning to have fun” isn't very much fun at all.
There are a few old standbys that work well: Bejeweled, Angry Birds, Peggle, Plants vs. Zombies, Candy Crush and so on. The problem is, although those games are fun, I grow tired of them fairly quickly—either that or they're so addictive I fear my family will disown me for ignoring them while I play just one more level.
Here are some games I've been playing lately:
Swish: it's a puzzle game, but it's just different enough that I find it fun. The physics seem “right” to me while playing, and the graphics are really great. The premise is that you're an alien playing basketball in space. You know, like aliens always do. There are 60 levels, and there's enough of a challenge to make it fun.
Dumb Ways to Die 2: I loved the first Dumb Ways to Die game. It was absurd. It was funny. It was cartoonishly morbid. Part 2 is more of the same, and that's a very, very good thing.
Asphalt Series: there are a bunch of games in the Asphalt racing series. Some of them work better than others, and all of them are fairly large downloads. I like Asphalt because you get to race really cool cars really fast. If you ever played Burnout on the PlayStation, Asphalt games will seem pleasantly familiar. You have to pay for gas if you play for too long, but I generally don't have enough time and play each session only until my gas is gone.
What are your favorite “five-minute games” for the Android platform? I never can really get into a book in that short amount of time, so it tends to be the only time I play games. If you have any suggestions, drop me a message at email@example.com, and I'll try to follow up in later months with the best of the best.
Note: you can find all the games mentioned here in the Google Play Store.
I'm apparently in a silly-game mood this month, because I stumbled across an open-source project I couldn't keep all to myself: Snk. If you remember the classic game of snake, Snk is the same concept, but smaller, harder and with music.
I actually really like the Snk program because it's fairly simple, and the developer (Mowglii) has put the Xcode project on GitHub for folks to download. If you're just starting with OS X Swift development, Snk is a project you can tweak for some learning on the fly.
My favorite part of the project is actually the “reviews” for it. Head over to www.mowglii.com/snk to grab Snk and its source code today. And, good luck with level three; I run directly into the wall every time!
Although I have covered a large number of science applications in this space, I haven't really looked at too many options available within the KDE desktop environment. This has been due to my own biases in using a GTK-based desktop environment, but now I'd like to look at some of the packages available for people who really like to use KDE on their own machines. So in this article, I'm starting off with the KStars astronomy program.
If you have the full KDE environment installed, you already should have it available. If you don't, you should be able to install it. For example, you can install KStars on Debian-based distributions with this command:
sudo apt-get install kstars
If this is the first KDE-based application that you are installing, it also will need to pull in a rather large set of dependencies—that's just the price of using a new GUI toolkit. Of course, any other packages will be incrementally smaller since all of the shared dependencies already will be there.
To launch KStars, you either can click on a menu item in your desktop environment or enter the kstars command in a terminal window. The first time you start KStars, you need to go through the setup wizard to configure elements like your location. Once KStars finishes starting up, you should see a display of the sky from the location you set during the setup.
You can pan the display around simply by clicking and dragging the star field to see locations of interest. The items that are labeled depend on your zoom level. Two buttons at the top of the display allow you to zoom in and out. Beside these is a third button, labeled Find Object, that you can click on to get a search window. This window can use filters to search for particular types of objects, like comets or asteroids, or you can search through all of the objects that KStars knows about.
Once you find an object of interest, you can click on it and have the display move around until the object is in the center of the display. If it is below the horizon, a warning box will pop up asking if you still want to re-center the display. Once you have selected your object, you can right-click on it to get a drop-down menu of things you can do with it.
The header of this drop-down contains the full name of the object, along with rising and setting times. Below that, the first option is to center and track the object. This is useful because the default display mode is to have the display updated in real time. This way, you always have a view of what the sky looks like right now. You can select the details option to pull up even more information on the object.
You can add a flag to make the object easier to keep track of or even add tracks as the object moves across the field of view. You also can calculate the angular distance to another object or plan out a star-hopping path to some other object.
For some objects, there may be images from the Deep Sky Survey available. If they are, there will be options on this drop-down menu labeled “Show DSS Image” or “Show SDSS Image”.
Although KStars comes with quite a bit of data when you install it, this isn't everything that is available. You can add new data sources by clicking on the menu item Data→Download New Data. This will open up a new dialog window giving you a list of what data catalogs are available to download.
For some of the data sets, like comet and asteroid information, there is a constant updating of the detailed information available to the astronomical community. You can download those updates by clicking on the menu item Data→Updates→ and selecting which catalog to update. You even can import your own data by going to the configuration window and clicking the Import Catalog... button on the Catalogs section. When you are in the configuration window, you can see that you also can change settings on how to view several different categories, such as solar system objects, satellites and supernovae.
The guides section defines what extra information is displayed, such as constellation lines, names and the Milky Way. The INDI (Instrument Neutral Distributed Interface) section controls how KStars talks to your connected telescope. You can pull up the telescope wizard by clicking on Tools→Devices→Telescope Wizard.
Once the connection is made, you can pull up the control panel and send instructions to your telescope. You can even automate your observations using this functionality. Clicking on the menu item Observation→Observation Planner will pop up a window where you can define a complete set of observations you want to run. If it is a bit confusing at first, a wizard is available to help walk you through setting up a plan.
While you will make your own observations, you also may want to look at observations made by other researchers. The file format most often used is the FITS format (Flexible Image Transport System). KStars includes a FITS viewer, which has a number of analysis tools. You can open a FITS file by clicking on File→Open FITS.
Several tools are available to work with the data in the image. You can look at the basic statistics of the image, including the width, height, maximum, minimum and mean of the pixels. You can pull up a histogram, showing the frequency spread of the image data. The View menu item includes several more tools where you can equalize the image, pass it through a high contrast filter or apply an auto stretch. There is even an entry to mark any stars that KStars can identify automatically.
You now have another astronomy program in your toolkit that you can use when your scientific research moves in that direction. In the coming months, I plan to look at other scientific software packages within this desktop environment and see just how much research can be done with KDE.
My friend and fellow Linux Journalian Kris Occhipinti recently posted a reminder on Facebook for everyone to back up regularly in 2016. Although it's something we already should be doing, if you're not a regular backer-upper, you should start today! The method of backup isn't nearly as important as the act itself, but this month, I found a new project that simplifies the backup process nicely.
Poppins is an open-source project that builds on the SSH and rsync programs to create an incremental backup system that is simple, fast and reliable. Tons of other backup programs are available, but Poppins doesn't try to be a full-blown system; rather, it's a simple one-liner that will do file rotation, snapshots and more. It can be automated with cron, or you can run it manually from the command line. (But you should really, really make a cron job!)
Other backup systems have more robust interfaces, restoration options and so on, but the beauty of Poppins is its simplicity. It's just one step above manually running rsync yourself, but that one step means it's simpler to do. In my world, simple is about the only way to make sure something gets done at all!
In fact, even though it's a new project and still in beta, Poppins gets this month's Editors' Choice award. It's simple enough that you might actually get around to using it, and it has enough features to really benefit you in the case of a catastrophic failure. Check it out today at poppinsbackups.wordpress.com, or go right to the Bitbucket page: bitbucket.org/poppins.
I love video game emulation. My favorite games were produced in the 1980s and 1990s, so if I want to play them, I almost always have to emulate the old systems. There is usually a legal concern about ROM files for games, even if you own the original cartridges, so I'm not going to tell you where to find ROMs to download or anything like that. What I am going to share is my recent discovery of the perfect handheld gaming system. Oddly enough, it was never intended to be an emulator.
The PSP is truly incredible hardware. The PSP Vita is its bigger, younger sibling, but if you have an old PSP, I urge you not to throw it away. With a simple firmware hack (also legally questionable, I suppose), it's possible to load emulators that will play Atari, NES, SNES, Game Boy, Genesis, PS1 and most other console games almost flawlessly.
I never had a PSP, but I was able to get a PSP Go in mint condition on eBay for $89. The PSP Go comes with 16GB of storage, so you don't even need to get its proprietary memory card to load it up with games!
One of the problems with the emulation scene is that sites seem to come and go fairly regularly. I found all the information I needed to get my PSP Go ready to play Mario by doing some Google searching for PSP emulators. Specifically, this page was great: wololo.net/emulators-for-the-psp-ps-vita-the-ultimate-download-list.
If you already have a PSP device, the instructions for custom firmware installation is simple. If you don't have one, deciding which version of the PSP to purchase is one of the toughest steps. If you like the larger layout, I recommend the PSP 2000 model. It has an incredible screen and fewer buggy design choices than the original. If you're looking for portability, I'm very fond of the PSP Go I purchased from eBay. The screen is smaller, but it's still plenty large and has beautiful quality. Good luck, and have fun!
Sometimes we do a thing in order to find out the reason for it. Sometimes our actions are questions not answers.
—John Le Carré
The greatest justice in life is that your vision and looks tend to go simultaneously.
There are some things you learn best in calm, and some in storm.
The only true happiness comes from squandering ourselves for a purpose.
If your ship doesn't come in, swim out to it!