Wednesday, September 8, 2010

COMPUTER KNOWLEDGE : About Threads and Cores and what to do with them



Heck yes ! The first time I do a 3 bullet action in one shot review in this blog. Folks sure had waited too long for this and I apologize ! But first i have to explain some stuffs on processors where most folks get confused with and its no rocket science but some basic daily science or math or both. So for today, only on processor explanations about cores and threads.

Now to those who didn't catch much news on the computing world and left out or stuck in the Core2 era, 4 cores is no longer the norm and something else just kicked into the budget range of quads, six cores or hex cores.
But seriously even 6 cores are norm, especially in server computing environment where minimally they run on at least 4 cores and up to 16, 32, 64 or even thousands of cores and somehow you must be very rich or having some government organization backing you up.

First of all lets get things clear, in processors we have threads and cores and what's the difference ? Well basically in layman's term cores consists of threads; for example a human with a body consists of a pair of arms and this is equivalent of single core + two threads, get what i mean ? right ? good. (1 cores = two threads or two cores = two threads)
A normal cpu core each have 1 threads and each of these threads have their own unique method of getting stuffs done which is what we called efficiency where I'll go in detail later.
Over the years manufacturers try to squeeze as much processing power out of the processor and various enhancement functionality surfaced but these functions sometimes provide noticeable performance boost and some will cause disadvantages.

THREADS

Hyper-Threading, a technology first introduced by Intel for their Pentium 4 Prescott models where their single core consists of two threads. The two threads helped reduced the queuing time of the data, for example if our human brain is fast enough to manage a pair of arms and a pair of legs and why not having 2 pairs of arms and 2 pairs of legs ? This will cause another problem, here let me show you a model on why having multi-thread on a certain processors will not provide any boost or even cause it to run slower.

Now, the image above shows that the load processor or the meat grinder able to chew up to 40 Kg of meat per second and the workload coming is 35 Kg so its not a problem for it. The meat goes in with 35 Kg a chuck and comes out in 35 Kg in bits and pieces.

This second picture shows that the meat grinder is still the same ol 40 Kg grinder, but the threads or input chunks are increased to two at the same time, which causes a choke of extra 30 Kg for the next round. Notice, a choke of extra 30 kg, which making doing the task twice in order to complete the grinding process of total 70 Kg.

Now this time, the meat grinder or processor have the power of chewing and grinding 70 Kg of meat, throwing two 35 Kg or one single 70 Kg won't be a problem at all. Chunk in , bits out just for once.

Within the threads, there's pipelines where the pipelines is like a slots for the meat to load into tray and with a maximum of 35 Kg and with lets say 10 maximum slots (3.5 Kg each). So now since this layman's term is direct, just replace the meat as data and you'll get what i mean. Capish ?

EFFICIENCY

The efficiency of the processor determines the capability of the multi-threading enhancement you get. Say with a old Pentium 4 2.8 Ghz with HT enabled which makes it two threads feeding data to the single core 2.8Ghz, the P4 2.8 Ghz is able to complete the 100mb of data within 1 seconds for example but the newer Core i5 single core 2.8 Ghz HT is able to get it done within nano seconds or 0.01 seconds. Let take a look on what efficiency looks like, in a picture that is.

As you can see, the meat grinder takes 10 seconds to completely chunk the 70 Kg of meat as one task. 10 seconds.
Now this time the meat grinder is the same old 70 Kg grinder, but instead its able to complete the 70 Kg grinding within 5 seconds which is able to complete 2 tasks within 10 seconds, this is called efficiency.

The efficiency of the processors or each computer component increases every year or even months especially new discovered methods are found. Efficiency is determined by the design of the processor, a processor is like a town with little roads to big highways with lots of traffic moving back and forth in different lanes to different location based on their purpose. Look below.

(courtesy of regmedia.co.uk.)

This is the architecture of the Nehalem processor, or we simply call it the Intel Core i7 architecture. Notice the Cores, the memory controller , the QPI (bus interconnect) and L3 cache ? each of these is like a connection or bridge between the processing hardwares. If one of them is not fast enough for others , it will cause a so called bottleneck for the whole thing, like the meat grinder above, chewing 70 Kg of meat while its only capable of chewing 40 Kg/s.


MY POINT BEING ? SOFTWARES....

My point is, HT is like an extra enhancement component. Multi-threading might sound good, but it might not be useful or even giving bad performance with incompatible softwares. (yes, we are talking about software now)

Seriously, as a user I'll hang myself if i waste a big bunch of money for something I never need but if i do, i'll be damn happy that its helping my job gets done faster.
The software layer plays a big role to make sure the multi-treading works efficiently in the processor. This comes the debate of whether games require how many cores to run.

While most software is mostly a single threaded application, running a dual core will not speed things up in the application, but overall from the view of usability , you're able to do graphics design and listening to musics at the same time. Apps nowadays are multi-threaded, so a dual core will helps keeping things fast without choke provided the game or application is multi-thread capable.

GAMES

Games for example, Command and Conquer : Red Alert 2 is a good old RTS which I'm still playing (seriously). This game is released around like 2000 ? back before HT or multi-cores were the normal scene.
The game requires a widely used Intel Pentium II/III with at least 450 Mhz or 800 Mhz for enjoyable gameplay. But the game still lags even on a modern processor, why ? simply because the game is not multi-threaded and it requires very minimal graphics requirements.
For example, In the image below during the beginning of the game I only have a few units and tanks to spare, or we call the soldiers "units".


With only such amount, I can select the soldiers to one location in a very fast manner without any delays and everything is fast, even building structures and the in-game animation. But things are about to change when time goes by.


What is this ? Well, i have to look into the fog of war, basically the black fog is the undiscovered place the units haven't been to yet. In this black screen, i can build units instantly even my fingers aren't fast enough to click build order new units more than 4 in queue. Basically, its fast ! everything builds too fast.


Looking back at my base, its a lag fest in there. I can click the build unit queue up to more than 15 and it's still processing the units, not to mention once i give these units an order to go somewhere it'll lag worse. The game still lags, even after 9 years. This shows we have different optimized games. One is multi-threaded while some older or even current games are single threaded, single threaded games requires more clock speed rather than cores and threads.


CORES AND THREADS ALONE WILL NOT SURVIVE

Grand Theft Auto 4, the controversial game that sets in a fictional New York named Liberty City with the liberty statue holding a coffee cup instead of the torch.
(courtesy of Rockstar entertainment)

This game was designed to make use of multiple processing cores, the only super multi-core end user affordable processor was the PlayStation 3, where 8 cores of action comes in a RM1.7k console. The cores works almost the same the personal computers, the processor is designed by IBM together with Sony and Toshiba (STI). The game sets in a near real life scene where lots of people, vehicles, buildings and different weathers happening in the game. So imagine like the Red Alert 2, with more things to display, the more processing power it needs. Ironically, the PS3 runs the game slower than the competitor's system while the competitors system only consists of 3 cores. Strange eh ? hehe, let me explain why. 

A game, unlike applications with not much graphic resource in display real time. The game actually relies alot on graphics processing power even the PS3 8 cores alone won't help. Other than the processor in the PS3, the PS3 have a build in Nvidia 7800 series GPU (graphical processing unit) to help process the graphics. The Nvidia 7800 was actually abit underpowered compare to the Xbox 360's ATi Xenos (simillar to the ATi X1900 desktop version). So for example, GTA4 have alot of things running, walking or moving in the game, which requires the CPU or processor to do the logical math, but to render or to display what the actions is like, a graphic card is needed to aid the display purpose. Unlike red alert 2, this game in layman's term, need more graphical power at the same time equally powerful CPU.

Bottom line is? Be sure to get something that makes balanced performance for what you do. Having a super fast CPU is certainly good when there are alot of actions going on, but at the same time you need some power for the graphics to render. The more powerful your CPU is the more taxing your GPU is when the game runs on multi-threading. Somehow a balance system is hard to find and create, testing and reading specs sure helps when building a system.

*also as an extra note, most games does not benefit from Intel's Hyper-Threading, this technology was mainly designed to help the server industry to save costs and provide more efficiency in the microprocessors especially servers that deals with small data, lots and lots and lots of small data where normal computer would crash running it 24/7.


SOFTWARE/APPS

I bet most of you readers know Adobe Photoshop, Photoshop comes a long way back since the Apple Machintosh era till now. Ranging from Photoshop to Photoshop CS5 (current), each of these versions have their own unique capabilities, especially performance boost or functionality.

An old Photoshop, is single threaded based and works well on a single cpu or dual cpu. But when it comes to applying filters on large pictuers for example, the app will be extrememly resource intensive especially on the processor and available rams.
Current Photoshops works best on a multi-core processors as they are well optimized in the workstation industry where multi-cores are the norm, especially dual socket quad cores with a total whooping 8 threads or 16 threads. But seriously, for normal editing or graphic designer a dual core is more than enough to get things done and saving a minute sometimes is not worth the extra $200 or $500. But , since quad cores are cheap and affordable, I don't see why not getting a quad.

Movie editors however requires alot more of processing power and memory, like 3D animations. They tend to stress the processor to the max when compiling a video or a set of objects in 3D environments. 8 cores ? barely considered fast. This is corrected with the help of dedicated professional 3D cards, for example AMD's FireGL or Nvidia's Quadro cards.

So ? If you're doing alot of huge processing , a quad or triple core is more than enough as long the price is right. Four cores @ 2.4 ghz and minimum 4 gigs of ram sounds about right and 8 gigs of memory hits the sweet spot. Btw, make sure you have large capacity hard disks as well. Hmm....if you're rich, don't mind getting what you want but what you need though, with an economy going down it sounds bad to me.


FINAL THOUGHTS - BOTTOM'S OF BOTTOM LINE

Now you should be able to know why some games will still lag even with the super duper uber 8 cores cpu and 2 x SLi CF graphic cards. Each games and application uses resources differently, to match a system with the usage we need its a difficult job. Sure throwing RM10,000 sounds about right to get a super fast computer, but using it for something that doesn't need such power sounds so damn wrong. BUT, look there's a but, since having a super fast computer and at the same time wasting resources for nothing , you can join folding communities to help making a cure for cancer. If you don't know what I'm talking about, look for F@h (Folding at home) on google.

Anyway, the cpu, mobo, rams and gpu combo review is coming in a day's time. Be sure to check out the blog soon !
www.sonoftrinity.blogspot.com

No comments: