What are Threads?
- A preemptive multi-tasking operating system supports
multiple processes running in parallel by allocating each one a
time slice.
- Each process runs on its own address space. That is, it gets
its own stack, heap, and other system resources.
- Threads are units of execution that can run in
parallel within one program. As such they:
- Start-up faster.
- Can easily communicate with each other. They can share
variables.
- Can be better controlled by the programmer (not by the
OS).
- They allow a program to quickly and efficiently handle
multiple asynchronous requests (e.g., requests coming from other
machines).
- Since they run in parallel, they exhibit many of the same
problems that arise in distributed programming. They are also
used in almost all distributed programming implementations.
- You must learn to control your threads!
José M. Vidal
.
1 of 8