Thursday, April 15, 2010

Why you should get a high end PC - RAM

This is part 2. Part 1 is here.

RAM is good. The more RAM the better.

RAM is so important that most of the time we just call it memory. There's lots of different types of memory attached to modern computers. There's hard disk, flash, buffer and cache memories to choose from. The thing is, when you just say “memory” and don't bother to qualify it, you mean RAM. That's how important it is. It doesn't even need the word “the” in front. It's implicit. That's how friggin' important it is.

The main benefits of having more memory is that allows you to use applications that manipulate huge chunks of data all at once.. Programs like this include games, photo editing applications, video editing applications and medical imaging viewers.

Generally you don't need to make the decision to buy more RAM. The applications you're using will do it for you. Essentially, one day you'll see a new, shiny application available for download that you just have to have. You'll download the application, try to run it and and suddenly realize you need more memory.

Windows 7 is the first consumer 64-bit OS from Microsoft that you'd actually want to run and unlike windows XP, it's not limited to 2 (ish) gigs of memory. Expect software developers to take advantage of the new memory situation by making their apps take up more memory (or should I say, "make their apps do something cool". No. No, I shouldn't.)

Curiously, modern operating systems don't just give up or complain when they run out of memory. Instead they will simply cram as much into memory as possible and stick the rest in the pretender-to-the-throne-memory – hard disk. In this case, you know you've run out of memory when your hard drive starts going bonkers and your PC slows down to a crawl. If you're not saving something or loading something your hard drive shouldn't be doing anything. If it is, you may need more memory.

Having more RAM than you need for the applications you run can also speed up the computer. If you have more RAM available than your computer is actually using, the machine will allocate the extra RAM to a disk cache. This is good because it means that even when you're loading something, it won't read it from the hard disk it will just use the copy already in memory. As a result, it loads incredibly fast. In my first article about storage I mentioned that before my solid state drive I used to get more RAM than I really needed. The disk cache is why. If you're too cheap to get an SSD at least max out your system memory. A run of the mill 7200RPM consumer grade hard drive will see huge gains. With a laptop's slow 4200RPM hard disk it's even more important.

(Cute girls know your laptop needs more RAM)

Note that caches work by keeping a copy of the data in memory after it's been read the first time from a hard disk. PCs often read the same things off the hard drive repeatedly due to the way programmers build their applications. The net result of this is that having a disk cache can make a surprising number of things faster.

One last thing, make sure you get your RAM from a reputable brand. Cheap, no name memory may seem like a good deal but there are quite a few bad RAM chips out there. Bad RAM can be a huge pain to diagnose since it just shows up as random crashing - which could be symptoms of almost any problem. A few good brands are Corsair, Kensington and OCZ. There are others..

So, in conclusion: RAM is good. The more RAM the better.

.. and, might I add: get more.

Next up: monitors. Why only having one is so old school.

Part 1

Sunday, April 11, 2010

Why you should get a high end PC - storage

I've noticed a recent article that said that Apple has a 90% share in the computer is over a thousand dollars category. I think this is rather sad.

I don't think it's sad that Apple is doing well, this is actually quite nice. What I find sad is that people aren't buying PCs over a thousand dollars. There are some excellent reasons why you'd want a PCs over a thousand dollars.

Let's start with the hard drive. Most PCs come with a relatively small hard drive. This is silly because coming with a small hard drive means you're actually paying a lot per megabyte. It also means your PCs that run very slowly because smaller hard drives have a smaller information density which means the drive has to spin faster to achieve the same data transfer rates. Every generation there's an optimum price point for megabytes per dollar. It's not that expensive either. Last time I check this optimal point was for hard drives costing about 100$. Getting a hard drive outside this range is just throwing money away in my opinion because you always need more hard drive space.

Hard drives are otherwise my mortal enemy. Hard drives have gotten tremendously large but they haven't gotten that much faster. While the transfer rate of the drive tends to be proportional to the size of the drive the access time is proportional to the rotation rate, the speed the head can move and physical size platter size of the drive. These factors haven't really changed. The rotational speed has only gone from 4200RPM to 7200RPM but the drive size has gone from 20 MB to being 1 TB in size. That's 1 000 000 MBs! Every time the system has to retrieve a byte from the hard disk it has to wait an eternity. I hate the stupid things! I've even gone so far as to add much more RAM to my system than usual to have a huge disk cache so my machine doesn't need to access the hard disk. Have you considered a solid state drive recently?

I've recently bought an OCZ Vertex solid-state drive for use with Windows 7 on my machine and it is completely awesome. To put the speed difference in perspective consider this: good hard drives have access times of around 18 milliseconds. Good solid-state drives have an access time of about an 0.18 of a millisecond. That's a hundred times faster. Additionally, they can have transfer rates of over 200 MB a second. Hard drives have a transfer rate of 50 MB a second. In practice the performance is extremely noticeable. I'll say it again, they are super awesome.

They only downside to a solid state drive is that it doesn't hold a great deal of data for the price. My OCZ Vertex cost around 400$ and only holds 120 GB. This isn't as much of a problem as you might think though because you just have to put all your data – music, video other data, on a standard hard drive and use your SSD for windows, the swap file and most of the applications. Your system will still fly and you can store all the data you want. I recommend getting a drive slightly bigger then you think you'll need. Getting too much space is a bit embarrassing, getting too little space is a time consuming disaster.

If you've bought a netbook with a solid-state drive and haven't really been impressed by the performance we're not really talking about the same things here.

(The difference in speed amongst SSDs is huge. It's worth reading up on why that is and which drives are really worth buying.)

The technology has come along way since those early drives. The software has also been improved. Windows XP will fight with a solid-state drive but Windows 7 includes optimizations to maximize the performance you get out of the drive. This means you don't have problems like, for example, the performance of the solid-state drive degrade over time. Modern drives also don't freeze the entire computer whenever you write lots of pieces of data to them at the same time. Early and current netbooks sometimes use out of date drive controllers that still have this problem.

Another thing that useful on the higher end PC is more memory. But I'll talk about that next time.

Part 2

Thursday, April 8, 2010

Space Smilies - a technological demonstration in one lvl

In 1999 I was first introduced to Java. I quite liked it. It was the first language that I'd come across in which it was possible to write your own draw routines while simultaneously being comprehensible. Sure, I already knew C and to a lesser extent C++ but to me it had always seemed like doing anything in those languages was incredibly painful. In Java it was relatively easy. The best thing about Java, though, was its runtime and draw routines were fast enough to write a small video game in. That March break I decided to write a video game. I called it Space Smilies after the placeholder smiley face icons I was using at the time.

Ever since then I've occasionally revisited code to see if I can figure out, using my newly acquired X years of experience, why somethings never quite worked right. I also spent some time to try and take advantage of the new abilities of the latest Java virtual machine (not to mention the processor power of the newest machines). I've just completed my latest batch of fixes and enhancements and am ready to release them to the world. Let me give you a rundown of what's been enhanced recently.

First off, I've corrected all those dang threading bugs. While I understood what threads were I wrote the original application I didn't really understand all the different ways in which you can screw up using threads. Since then I've learned a great deal about threads and, in fact, have become quite familiar with them. As a result of this, the newest version of Space Smilies draws the back buffer to the component on the event thread. It used to draw back buffer to the component on the thread I was using for the game engine. This doesn't really work well because AWT and swing aren't thread safe.

I'm also using a sort of triple buffering. The game engine draws to a back buffer. This back buffer is then given to the event thread on a sort of back buffer queue. The event thread then takes the latest back buffer and draws it to the component. After drawing to the component the back buffer is put into a free pool. When the game engine needs a new back buffer for the next frame, it looks in the free pool to see if one is available. The upshot of all this is that the final blitting is done on a different thread than the game engine which is doing the compositing.

Additionally, I'm using volatile buffers wherever possible to let the video card do most of the blitting and compositing. For whatever reason I can't get bit masked volatile buffers to be accelerated. This means that the bulk of the compositing is done on the CPU although the star-field (which is the biggest blob of pixels by far) is composited all on the video card.

(This is all on windows, your millage may vary on other operating systems)

Finally, I got the resolution of the game up from postage stamp sized to 1000 x 700. The old game used to remain fixed at that resolution but the new game will scale itself to take up as much area on the screen as it can.

I'm quite interested to know whether it works for everyone. You'll need Java 6 though. With any luck you actually have that but don't know it. Try it out either way.