I want to bring my CPU which I used in Canada for over 2 years to India with me. What is the best way to do that? Should I check into baggage or carry on or ship it via courier service?
CPUs are relatively sturdy and quite light, so any way you can carry it is fine. Push it into a sponge or styrofoam pad so that pins do not get bent. I would put it in the carry-on luggage since I would prefer keeping an eye on it, just because it's valuable and small which makes it an easy target for thieves.
[EDIT] With the CPU pins in the sponge, insert it into a anti-static. Most computer parts come in one, so you probably can find one even if you do not have the original.
Couriering it does not seem like a reasonable option because that is quite costly. Even a small package like that shipped to India with tracking or insurance probably costs a significant percentage over what a 2 year old CPU is worth.
The best way would be to ship it via a courier company as you own the computer and it's over 2 years old desktop, I presume it to be heavy, and to carry it as baggage item you would have to pay a lot more.
The best way to transfer a bulky computer to another country for 2 years is simply not to. Sell it, and take the money with you and buy a new one when you arrive. Then when you return home, sell it again and do the same when you return home again.