I\'m always confused about thread concepts. I haven\'t a chance to use them in a real environment so far. It would be helpful if someone could explain threads for me.
At the risk of oversimplifying:
A thread is a line of execution through a program.
In your basic programming model, the computer simply traces through your program one statement at a time, and at any given time, only one statement is being excecuted. If your program branches or calls another routine, execution will leave the place where control transferred and begin executing at another place, but still, only one thing is being done at any one time.
With threads, multiple lines of control can be executing at the same time. For example, one part of your program can be interacting with the user, while another part is downloading a file in the background. Multi-threaded programs are much harder to program and it's much harder to envisage how they work.