OK. Here's an overview.
1) a thread is a sequence of instructions to execute. Like main(). Instructions are executed on after another on and on through all the function calls until main is completed. Then the thread dies.
2) You can create you own threads. These are usually functions that have a specified argument list and return type. This varies by operating system. For Windows yout thread function must be:
-
DWORD WINAPI MyThread(LPVOID);
-
Any function of this format can be a thread.
3) You make an operating system call to create your thread and start is executing. For Windows you would use CreateThread.
4) Your thread exists until the function is complete. Then your thread dies.
5) main() and your thread do no know each other exists. If the thread and
main() use common variables, you will have big trouble unless you install a traffic light (research mutexes, critical sections).
6) your multithreaded program will run slower than your single threaded program. The time used by the thread is part of the time the OS scheduler has allowed for your main(). This will vary by the CPU in your machine. It will also vary by using multiple cores. This part gets deep.
7) you can talk to your thread from main() by using and event.
8) the more threads the slower it goes.
9 creating a thread is not the same a creating a child process. This is a wole other area.
If you are using Windows, read Windows via C/C++ Jeffrey Richter 2007. Multithreading is covered in great detail.
Good luck.