What is a “thread” (really)?

I have been trying to find a good definition, and get an understanding, of what a thread really is.

It seems that I must be missing something obvious, but every time I read about what a thread is, it’s almost a circular definition, a la “a thread is a thread of execution” or ” a way to divide into running tasks”. Uh uh. Huh?

It seems from what I have read that a thread is not really something concrete, like a process is. It is in fact just a concept. From what I understand of the way this works, a processor executes some commands for a program (which has been termed a thread of execution), then when it needs to switch to processing for some other program for a bit, it stores the state of the program it’s currently executing for somewhere (Thread Local Storage) and then starts executing the other program’s instructions. And back and forth. Such that, a thread is really just a concept for “one of the paths of execution” of a program that is currently running.

Unlike a process, which really is something – it is a conglomeration of resources, etc.

As an example of a definition that didn’t really help me much . . .

From Wikipedia:

“A thread in computer science is short for a thread of execution. Threads are a way for a program to divide (termed “split”) itself into two or more simultaneously (or pseudo-simultaneously) running tasks. Threads and processes differ from one operating system to another but, in general, a thread is contained inside a process and different threads in the same process share same resources while different processes in the same multitasking operating system do not.”

So am I right? Wrong? What is a thread really?

Edit: Apparently a thread is also given its own call stack, so that is somewhat of a concrete thing.

10 Answers
10

Leave a Comment