Mike95 C++ COM Server library
What is a thread? A thread is a light-weight process. Light weight simply means the process is not being controlled by the opperating system directly as in a normal process. Instead a thread is typically spawned by a process itself and runs within the confines of the parent process who created and started it. An application can have many threads running concurrently handling many different independent tasks. If an application is terminated abruptly, all it's threads are also terminated (much like when an operating system is closed, all of it running processes are also closed).
As good example of how threads are useful, lets suppose you have a large Word document and you chose to print it to your printer (lets assume your printer can only hold one page in memory at a time and there is no buffer queue provided by the OS). Even though word is busy printing, there is no reason why you should not be able to scroll through the document and be re-reading it. What essentially happens is simple, a thread for the printing is spawned and delegated the task of coordinating the printing process while another Word thread continues reciving your input and actions.
|