Sunday, 5 August 2012

Microprocessor: its working and concept of pipelining and superscalar

My last article was on microprocessors and the current and future trends of multi-core microprocessors and its drawbacks. I was pointed out by one of my readers that without the proper knowledge of the working of microprocessors, the concepts of pipelining and superscalar, it’s hard to understand the shift from single core microprocessors to multi-core microprocessors. So this is what this article is about. I am going to describe you the working of microprocessors then we will discuss about the concept of superscalar and pipelining.

Let’s first talk about the working of the microprocessors. A basic microprocessor has a CPU, Memory storage Unit and I/O devices which is connected through a data bus and an address bus. The CPU contains ALU, control Unit and a clock which describes the frequency at which instructions are processed. The execution of a single machine instruction can be divided into a sequence of operations called the instruction execution cycle. Before executing, a program is loaded into the memory. The instruction pointer (IP) contains the address of the next instruction. The instruction queue holds the group of instructions which is about to be executed. When the next instruction is called, the address is taken from the IP and the IP is updated with the new address from the instruction queue. Executing a machine instruction requires three basic steps: fetch -> decode -> execute. Taking the data from the memory uses two more steps: fetch operands and store output operands. Therefore there are six steps in the Instruction Execution Cycle for a single machine instruction:
Fetch instruction -> decode -> fetch operands -> execute -> store output operands -> next instruction -> fetch instruction again and so on.



Instruction Execution Cycle

After completely understanding the working of the microprocessors it will be easy to under the concept of pipelining and superscalar architecture. What is pipelining? Pipelining is the technique used to make CPU run faster. Pipelining is the implementation technique whereby multiple instructions are overlapped in execution. It takes advantage of parallelism where the instructions are not dependent on each other. The six-staged non-pipelined execution will take n*k cycle to process when n is the number of instructions and k is the number of execution stages. On the other hand, the six-staged pipelined execution will take k+ (n-1) cycles to process. The concept can be further explained using the following diagram.
Six Stage non-pipelined Execution


Six Stage pipelined Execution

A superscalar CPU architecture implements a form of parallelism called instruction level parallelism within a single processor. It can be thought of having 2 pipelines. It therefore helps provide a faster CPU throughput than would otherwise be possible at a given clock rate. The throughput of an instruction pipeline is the rate at which an instruction exits the pipeline. In a single pipeline execution if the execution stage requires more than one cycle then we have wasted cycles. In general for k stages (where one stage requires 2 cycles), n instructions require (k+ 2n- 1), cycles to proceed. On the other hand in 6-stage pipelined processors wasted cycles are removed, so n instructions can be executed in (k+ n) cycles, where k indicates the number of stages. This can be further explained using the following diagram.
Six stage single pipelined non-scalar execution
Superscalar six-stage pipelined execution
The concept of parallel computation is as old as 1958 when IBM researchers discussed the use of parallelism in numerical calculation for the first time. The difference between multi-core processors and superscalar is that superscalar architecture has multiple fetch, decode and execute block in the same processors whereas a multi-core processor is a single computing component with two or more independent actual processors (called cores). These multiple cores can run multiple programs at the same time, increasing overall speed of the computer. This is the main reason why there was the use to shift from single core to multi-core microprocessors which was discuss in the previous article.
Written by:
- Ahmed Ahsan Khan.

Friday, 3 August 2012

Microprocessor: Current and future trends in multi-core microproccessors and its drawback

 Intel microprocessor 4004

Microprocessors are multipurpose, programmable device that accepts digital data as input, processes it according to the instructions that are fed in its memory, and provides the result as the output. Microprocessors operate on numbers and symbol represented in binary number system i.e. 0 and 1.

The first microprocessor was created by Intel in 1971 (Intel 4004). And the first microcomputer was created in 1972. Intel was founded in 1968 by Gordon E Moore (Physicist and Chemist), Robert Noyce (Physicist and co-inventor of ICs (Integrated Circuit)) and Arthur Rock (investor). The company was named Integrated Electronics, Intel for short.  

Intel has shifted its design from single core to multi core processors in 2004. There have been some reasons due to which this shift has been taken. According to Moore’s law, the number of transistors that is used in the microprocessors would double every two years. But as time passes, assumption about performance and power consumption were also made and it shown to advance similar lines. 


During that period there was one more visionary at work, Dennard. He predicted that oxide thickness; transistor length and transistor width could be all scaled by a constant factor. The density of the processors also increased. This scaling is what gave Moore’s law boost. It’s the reason the general purpose microprocessors was able to overtake and dominate other types of computers. Due to advancement in circuit technology and performance limitation in wide-issue, super-speculative processors, chip multiprocessors (CMP) or multi-core technology has become the mainstream in computer design.

For the past 7 to 8 years, Intel and AMD have emphasized multi-core CPUs as the answer to scaling system performance. It’s a fact that adding more CPU cores never result in perfect scaling. A multi-core processor is a single computing component with two or more independent actual processors (called cores). These multiple cores can run multiple programs at the same time, increasing overall speed of the computer. Dual core processors have 2 cores, tri- has 3 cores and quad- has 4 cores and so on.

The main trend that Intel followed in their development was to make faster and smaller processors. The general trend in processor development has moved from dual-, tri-, quad-, octa-core to ones with tens and hundreds of core. In addition to that, multicore chips mixed with simultaneously multithreading, memory-on-chip and special purpose heterogeneous cores promise further performance and efficiency gains, especially in processing multimedia, recognition and networking applications. There is also a trend of improving energy-efficiency by focusing on performance per watt with advanced fine grain or ultra-fine-grain power management and dynamic voltage and frequency scaling.

There has been some reason why this shift has not been able to produce the desired result. One of the biggest reasons is that in any parallelized program, performance is ultimately limited by the amount of serial code. Serial code can only be executed by only one processor as the instruction is read one by one. This is known as Amdahl’s law. Other factors, like the difficulty of maintaining concurrency across a large number of cores, also limit the practical scaling of multi core solution.

The improvement in performance gained by the use of a multi-core processor depends very much on the software algorithm used and their implementation. The pace at which development of parallel programming has been increased is very slow as compared to the increased number of multi-core processors being made and brought into the market. Parallel programming languages have been introduced for example, Cilk++, OpenMP, fastflow and MPI that can be used on multicore platforms.

Having multiple cores on a single chip gives rise to challenges and problems. Power and temperature management are two concerns that can increase exponentially with the addition of multiple cores. If two cores were placed on a single chip without any modification then the chip would consume twice as much power and generate a large amount of heat. In the extreme case, if your processor overheats, your computer may combust. For prevention we run the multicores at a lower frequency to reduce power consumption. These are some of the reasons that were faced by the microprocessor industry while developing the multicore processors.   

Written by:
- Ahmed Ahsan Khan.

Wednesday, 1 August 2012

Alexander the great's 3 last wishes


Alexander the great was the Greek king during 300 BC. He is considered as the most successful commander in the history of man-kind with all unbeaten battles. His was tutored by Aristotle who was a Greek Philosopher until the age of 16. When Alexander was 30 years old, he conquered a large piece of land that stretched from Lonian Sea (now connecting Italy to Greece) to the Himalayas, northern part of Indian subcontinent. It was one of the largest empires in the ancient world.
During the time when he was dying while on his way back home he made 3 wishes to his general to be done after his death. The generals promised to follow his wishes after he pass away. The wishes were:
1.     “My physicians alone must carry my coffins.”
2.     “I desire that when my coffins is being carried to the grave, the path leading to the graveyard must be covered with all the gold, silver all the precious treasure which I have collected during my kingship.”
3.     “My last wish is that both my hands be kept dangling out of my coffin.”
It’s hard to believe that these are the wishes made by someone who conquered half of the world in such a short time. It shows the limit of modesty and down to earth personality of a person one can possess. There is some deep reasoning behind the wishes which he had made.
1.     He wanted physicians to carry his coffins because he wanted to show the world that no one can save anyone from death, not even his doctors and physicians. A man should not take his life for granted rather he should be prepared that one day he will face death.
2.     The second wish was to tell the people that despite a person collect so much of treasure in his life time, not a single bit of it will go with him once he died.
3.     And the third wish was to show the world that once a person is dead he goes from the world empty handed.
He is quoted to have said:
"I am dying from the treatment of too many physicians."

Written by: 
-  Ahmed Ahsan Khan

Monday, 30 July 2012

Living on the Edge

This is not about the "living on the edge" reality show. This is about real living on the edge. By edge I mean the two extreme points that every thing on earth have, (except the earth itself as it is round).

In the modern era everything is reaching its limits, or maybe close to it. The rich are getting richer and at the same time poor are getting poorer. This type of situation may occur when we have insufficient control on the flow of money. The country with corrupt government has their rate of corruption at its peak whereas the developed countries are busy in maintaining their rate of development. We have people who are travelling in latest automobiles and aircraft, using smart phones and laptops while at the same time we see news of people living without electricity for more than 24 hours and people dying because of hunger.

In case of religion we have the same story. When the month of ramzan is here, there are many group of people who are busy in the recitation of the Holy Quran, collecting and giving out zakat and donations and at the same time we have people who are avail the opportunity of late night talk-time/sms packages and daily iftar deals at fast-food restaurants. There are also companies who advertise their product with half-naked women in their advertisements and banner i.e. Boutique ads for eg. for marketing of their eid collections suits. Other than ramzan also we have increased number of jamaats that are going out in order to spread the words of allah. On the other side of the picture due to development of media we have increased number of tv channels showing movies of all types.

All the positive sides of the picture are because of the development in the private sector and the negative ends relate to the ignorance or non-implementations of the policies of government sector. These can get better if the flow of money can be controlled by the people who are given responsibility to do so. For that we need to choose correct people for the task to be performed. We can put sensors to eliminate vulgarity and nudity. I hope and wish all the best to the upcoming new government that they work hard to have a positive start in their tenure of the new 5-year session.

Written by:
- Ahmed Ahsan Khan.

Sunday, 29 July 2012

Friendship

In your recent years or so you must have lost some of your very close special friends. People who were very close to you may have disappeared from the screen of your life. The relationship of friendship is simply very amazing. A single quality friend has much more worth than many so-called friends. Its amazing when Strangers become friends but its very sad when friends becomes strangers. You might never have thought that you would loose contact with your close friends. But its part of life. You make new friends now and then. The best thing about friendship is that you build up your golden memories with them which stays with you throughout your lifetime. Now when you sit back and think about those precious times which were spend with them like late night gossips, walking on the road and watching movies together to name a few and you smile and when somebody asks u the reason for your smile, u just say NOTHING! Its a funny little feeling like that.

Friendship is one of those beautiful relationship in which you don't hesitate to share any small secret of your life. There is no formality. Its a relationship in which you fight one second ago and then everything comes back to normal in just a blink of an eye. I have experienced some very good friendships in my life and I personally think its once in your lifetime that you get true friends in your life and once you get it, should not leave their hands. If you leave them, you might never get it back. Its actually very hard to find who is your true friend and who are just good actors. No valuable stuff is free of cost. At least not in this costly world. Not even true friendship. You need to sacrifice sometime out to find that. As one of the famous saying goes on to say "a friend in need is the friend indeed".

Have a nice day.
- Ahmed Ahsan Khan.

Monday, 23 July 2012

Stepping into the new era - Part 3 Message to the Critics

Now come to the critics of our country. People always try to criticize our country on issues like politics, education and poverty of the country. I want to tell them that if they really love their country then they should stand up and try to make a difference. This is our country and we are to this country as a cell is to human body. It is we who break laws, we are the one who break traffic signals, and we are the one who bribe the traffic police in order to get away from the traffic fines that otherwise we had to pay. I never said that we are the perfect nation. As mentioned above there is many room for improvement and it seems like we, the people of the country, have the potential to make this country a perfect one and shine to the world as a star shines in the night sky.

People don't avail their right to vote. More than 50 percent of the populations don't vote, according to the 2008 election statistics, only 44.55% of the population casted the vote. The people who don’t cast their votes are the one who have the correct knowledge of the current situations of the world and their country. If they don't vote then they don't have the right to criticize on the current situations of the country. They are the literate lot of the country who if cast their vote can certainly make a difference by choosing correct leaders for their nation. I agree that we have low rate of education. But it does not means that it stop us casting vote. As far as education is concerned it is also increasing day by day. The numbers of students’ intake in the universities across the country have increased by more than 200 percent in the last decade. These universities are providing some quality education to their students.

The point I want to raise here is that for any nation to prosper, its every single entity should work its 100 percent best towards contributing to the welfare of the country. The rate of development has been slow. Agreed. But this is not the end. This should be the start of the development and if every person of this country starts to take responsibility then we can overtake any country of the world. In order to improve our country we should always improve ourselves first. The start should start from I.
 

Have a nice day.
Written By:
Ahmed Ahsan Khan

Stepping into the new era - Part 2 The way forward

The people of Pakistan have increased their living standards in the last decade. The increased number of vehicles with signal free fast flowing roads tells us the story all by itself. We have access to the latest hi-fi technology of the 21st century including I-phones, laptops, mobile phones and you name it. In the last decade we have increased our internet users of the country from 0.1% of the population in 2000 to 10.4% of the population in 2010. We have international brands across the country like Nike, Adidas, LEVI'S, Crocs, GAP etc. The internet provides us access to the latest books, news and information of the world. Though the numbers of people using it are very limited but it is gradually increasing every single day. We have one of the cheapest telecommunication services of the world, including cellular service and internet service. 68.8% of the population has mobile phones due to the work done by the private telecommunication companies like Mobilink, Telenor, Ufone, Warid,  Zong etc.

During my stay at South Africa I visited many shopping malls of different kinds. Every mall has its own interior design and architecture. And most of the shops were owned by either their local brands or international brands. As per my opinion malls are one of the most important tourist spots for shopping purpose. I visited a couple of malls here in Pakistan including Park Tower, Atrium and Dolmen City mall. When we went into the mall, it reminded me of the malls in South Africa. It had most of the international brands which we can find in any other mall outside the country including Nike, LEVI'S, GAP, Crocs etc. There were some local brands too like JJ's, Khaadi and Gul Ahmed. The interior of every shop was speaking for its own uniqueness. It was a good experience visiting the malls and it shows that we can provide some life time shopping experience for our public. The thing is that we need to maintain our assets which we have developed and go further from there.

Let's now talk about another latest tourist spot Port Grand situated in Karachi, located on top of the sea, where the waves of the Arabia Sea hit the logs that support the floor of the port grand. When we entered its premises, it reminded me of waterfront mall in Cape Town. Port grand was a great place to visit. A good tourist point that we have developed at the coast. The restaurants were also very nice. After walking around and spending some money in the shops we went upstairs in the open air to have dinner. The feeling was like sitting on top of the cruise in the late night under the moonlight. Food is one of the most important part of human life and to enjoy food in the night sea breeze is something a man can dream of.

Continued...