What is the best way to multi-thread in c language? Very efficient or not CPU hog. Thanks
If you're on a UNIX-based platform (Linux or Mac OS X) your best option is POSIX threads. They're the standard cross-platform way to multithread in a POSIX environment. They can also be used in Windows, but there are probably better (more native) solutions for that platform.
Your question is a bit general to answer effectively. You might look into such things as:
CreateThread in the windows SDK
boost::thread
The correct (standard) way to do this on C and Windows is with __beginthreadex.
This is usually preferred to calling CreateThread directly as CreateThread doesn't init C runtime support for the thread. So if you create a thread using CreateThread, and call a CRT function, bad stuff can/will happen.
Note that __beginthreadex calls CreateThread internally, but performs some other work behind the scenes.