
The geek-chic OpenMP logo.
This is a brief intro to using OpenMP for parallel programming (with what I’ve discovered about it so far). We’ll implement a Mandelbrot Set renderer that runs multicore, and throw in a couple aside-goodies as well (basic supersampling and Mandelbrot continuous coloring).
First, let’s talk parallel programming. The basic idea here is that we have some task that can be split up into parts, and we hand off each of these parts to different CPUs.
Read more…

A manatee very quickly performs his "float" task before voluntarily returning control to the cooperative multitasking system.
In the Good Old Days of Mac OS 9 and Windows 3.1, there existed a notion of multitasking known as cooperative multitasking. This is when the OS schedules tasks to run, and gives the tasks complete control of the CPU for as long as they want it. Tasks would voluntarily relinquish control after not too long, so that other tasks could run.
Of course, a greedy task could just take over the system and not let anything else run, but such a task would lead to an unpleasant user experience, and so such software was unpopular. In other words, it was in the software’s best interest to be cooperative.
Not could greedy tasks take over the system, but buggy ones could, as well! This would lead to system hangs, and user unhappiness. Real computer operating systems, like Unix, BSD, and Linux, shunned cooperative multitasking and instead used the superior idea of preemptive multitasking, in which the OS forcibly takes control away from a process when that process’s time is up… no more hangs! All modern desktop OSes, including those from Microsoft and Apple, have left cooperative multitasking behind.
So why even talk about it at all? Well, it’s a good way to bring up another idea in C: function pointers.
Read more…

Where can I find a free image that represents "fuzz"? This will have to suffice!
Hands up everyone who likes writing tests for their code!
Hello…?
Yeah. For the record, I’m a big fan of test-driven software creation… in theory. In practice, it doesn’t always happen.
But let me tell you one of the main benefits of having tests in place for your software: peace of mind. It’s easy to rerun the tests, and you have that much more security in the knowledge that, when you make a change, the software is correct.
Read more…

A human listens to Mozart's Violin Concerto No. 3. Either that or it's "Ace of Spades" by Motörhead.
Let me start off by saying, “Don’t do any of this yourself.” This is one of those topics where there are countless libraries already written for you with well-designed and well-tested code to do everything you want and more. It’s presented here because it fits criterion #1 for why you’d re-invent the wheel: you’re doing it because you want to learn more about it. So there you have it!
There are many ways to represent sound digitally, but let’s start with sound in real life. The situation we have is that a bunch of alternating high- and low-pressure waves are moving through the air like ripples in a pond. They reach your ear and push your eardrum in and out. The eardrum’s connected to the what’s-it, the what’s-it’s connected to the thing-a-ma-bob, and the thing-a-ma-bob is connected to your brain, which fools you into believing you’re hearing something, depending on how your eardrum is moving.
Read more…