Tech Tuesday: Turing Machines

2012 is Alan Turing year, celebrating the life of one of the founders of computing and one of the minds behind the cracking of the Enigma code. In honour of this, I’m writing a couple of Tech Tuesday posts about Turing’s contributions to computing.

This post, is about Turing Machines. He called them a(utomatic)-machines but they later became known after their inventor. To my knowledge, Turing never actually made one of these machines but he described them in 1936 as a theoretical exercise. By defining a machine that could calculate, or computer, answers to problems, he was able to know whether or not certain problems were actually solvable.

But what is a Turing Machine?

A Turing Machine consists of a few elements. First, you have a tape, broken down into equal sized sections. Each of these sections may be blank or may have symbols written in them (usually, 0 and 1, but you can have more). In general, when people talk about Turing Machines, it’s considered that this tape can be as long as necessary to complete the computation, so the tape is theoretically infinite.

The second element of the machine what’s called a head. This head is something which is pointed at a single section of the tape. It can read whatever symbol is written there as well as write a symbol onto the tape, replacing whatever symbol was there to begin with.

The machine also has a set of rules. These rules look at the state the machine currently is in as well as the symbol written on the tape and determines a next action. For example, if the machine is in state A and 1 is written on the tape, write a 0 onto the tape, move the tape to the right and go to state B, if 0 is written on the tape, write a 0 onto the tape, move the tape to the left and go to state C.

You also need to define what the starting state is for the machine and one or more stopping states. If a machine arrives at a stopping state, the calculation is over.

But why should people care about Turing Machines? Nowadays, computers can do a lot more than just move a tape back and forth. Yet Turing Machines were discussed in two different modules of my university course because they are still significant in understanding computing.

One reason is the power behind this apparently simple model. You can, in theory, calculate using a Turing Machine anything that you could calculate using a more complex computer. I say in theory because there are a couple of things that Turing Machines aren’t good at (solving two problems at the same time, for example) and because it wouldn’t be practical to use a Turing Machine as the complexity of the problem increases. While the model allows for the tape to be as long as necessary and for the machine to have as many rules as required, you wouldn’t want to build or simulate a Turing Machine with a tape twenty thousand miles long with five thousand states and a few million rules. You’d be sitting forever waiting for the calculation to complete.

Once you’ve accepted the limits of practicality however, these machines are very useful in the theory of computability. This is the study of what can or can’t be computed. Essentially, there are some problems a computer is capable of solving and some which is can’t. A problem is proved to be computable if you can design a Turing Machine that would solve it. As stated above, this isn’t necessarily practical, so a problem is also proved to be computable if you can solve it using functions which have been proved by Turing Machines. For example, it’s possible to design a Turing Machine that adds two numbers together, therefore addition of two numbers is solvable. Multiplication can be thought of as repeated addition (e.g. 3×4 is just 3+3+3+3) and since we’ve proved with a Turing Machine that addition is computable, multiplication is computable. You can do this again and again, building up the complexity until you can work out if very complex functions can be computed.

When computers were first created, they were a long way from the machines we have today. The earliest computers were machines that, as the name implies, computed the answers to calculations. Turing Machines were the first of these and so were the foundation that led to the massive range of computers available to us today.

Tags: , ,

Tech Tuesday: Where Does Data Live?

Watching Terminator 3, there was a moment that really annoyed me. It was a while ago I watched this film, so I can’t remember the exact line, but it implies that Skynet couldn’t be stopped because it was loose on the internet and no longer on the servers.

The reason that annoyed me is that all computer programs are, when you get down to it, data. All data has to be stored somewhere. Every piece of data on the internet, whether it’s an online game, a video of a cat fighting a printer, a website of adult content, or a chapter of fanfiction, has to be stored somewhere. Data gets stored in servers.

Every website is hosted on a server. There are companies that make their money by having a load of physical machines with lots of memory, essentially renting some of that space to website owners. If you create a website, everything you put on it gets stored as a load of ones and zeros on a server owned by one of these companies. Everything on the internet is on a server somewhere.

That’s why I was annoyed about that bit in the film because Skynet couldn’t exist as some detached entity in the void. Skynet had to be on severs somewhere. Blowing up those servers would stop it.

There would have been ways to make the plot work, even taking this into account. We’re talking a hugely intelligent AI program here that was acting as a virus. They could have said that Skynet was hiding in other computers as malware and that there was no way to erase it from enough machines to do damage before the end of the world.

This is why it’s important to get the technology right (or your historical information, or your facts about riding horses long distance, or the details of police procedures, or just about anything else). When you write a story, you will include information on a range of subjects. There will be someone who reads your novel or watches your film who really understands this topic. If you’re not careful about keeping your facts straight, someone will be mentally screaming, “That’s not right!” when they come to your little slip up.

You won’t get all the little details right all of the time, but please make sure that there are no huge errors. If in doubt, find someone who knows the subject and ask them to read what you’ve written.  

Tags: , , ,

Tech Tuesday: Backups

I think it’s a fair bet that most novel writers do most of their writing on a computer. There will still be some who prefer to write by hand and many of us carry notebooks in case of a moment of inspiration. But the fact is that using a computer makes things so much easier. It’s easier to edit. You get such wonderfully useful tools as automatic spellcheckers. You can move whole sections of plot around. There’s even find and replace if you decide to change a character’s name after you’ve written several thousand words.

But there is a danger. If your 100000 word novel is sitting on your computer’s hard drive, what happens if something goes wrong? The something could be one of a few different things.

Your computer could get a virus. If you’re careful, the risk of this is low, given anti-virus programs and the fact that most computers will warn you if you’re in danger of infecting your computer. But the danger still exists. Some viruses are more of a problem than others, but many computer viruses will lead to corrupted files. If your computer gets infected, you might find it refuses to turn on again. In which case, your masterpiece is sitting on a hard drive you can’t get to.

There’s also the possibility of accidental damage to the computer. Maybe you’re moving house or carrying your laptop between rooms and you end up dropping your precious machine.  Next time you try to turn on the computer, you see an error message or worse, nothing.

In both of these cases, there’s a good chance you can rescue your documents. The chances are that the files you want are still intact and if you take your computer into a repair shop, someone should be able to extract your files for you.

The third thing that could go wrong is more of a problem. What if your computer gets stolen? In that case, the odds of you getting your files back are only fractionally above zero. Insurance can’t help you get your manuscript back intact.

This is why backups are so important. Another benefit of writing on a computer is that it’s much easier to back up a computer file than it is to back up a notebook full of handwriting.

One of the most common methods is to do a full backup. Most computers have this option automatically, allowing you to essentially create a copy of the state of the computer. You back up to an external hard drive and, if something goes wrong, you can restore to the exact point you did the back up. This has the benefit of backing up more than just your files. You can save your programs, settings, favourites and just about everything else. This way, even if your computer is stolen, you can restore everything onto a new machine and everything will be back. Just be careful if you’re backing up to an external hard drive that you don’t leave that next to your computer. If you do, chances are that if one gets stolen, the other will be gone too.

If you’re just interested in your novel files, you don’t need to do a full back up. You can just save those files somewhere else: onto CD, on a USB flashdrive, or even online. There are various free online storage solutions, such as Skydrive or Dropbox, that allow you to store your files out on the internet. If you put your files online, then even if your house burns down and destroys everything in it, you’ll be able to get back those files.

A third, simple option is to email files to yourself. Send yourself your story files as email attachments and you’ve got a backup stored in your email system.

Whatever method you choose, the importance is to do it regularly. If you lose your files in July, you don’t want to realise then that you last did a backup in January. If you keep your backups regularly updated, all you need to worry about now is writing the novel!

Tags: , , ,