Hi,
I often hear ppl saying multi-threaded or multi-thread applications from time to time. But can anyone tell me what exactly is a multi-threaded program?
thnx in advance
Printable View
Hi,
I often hear ppl saying multi-threaded or multi-thread applications from time to time. But can anyone tell me what exactly is a multi-threaded program?
thnx in advance
have a look on www.planetsourcecode.com
for
"multi tasking"
The CPU of a computer is able to execute only one process at any given point of time. When multi-tasking came into existence, it made efficient use of the CPU's huge speed by introducing the time shares. A certain piece of time is given to each process to execute. Once the time slice is up, the process is put on hold, and the next process is taken up for execution. Since the CPUs run at huge speeds, you wouldn't notice this and think that the processes are running parellel.
The same concept, when applied to an individual process, becomes multi-threading. A single process, when being executed, executes line by line. You can identify code segments in your process which do not need to be run one after the other. This means, both the code segments would give the same result if run simultaneously, they wouldn't affect each other's working if both were run together. In such a case, the process is split into threads, and each thread runs for a slice of time, then is put on hold and the next thread is run and so on.
In short, if you know how multi-tasking works conceptually, multi-threading is almost the same in concept.
.
I think i get the idea. But to help me understand it a lil more, can someone upload a very basic app that demonstrates the process pls?
many thnx