04-03-2013, 04:06 PM
Threads
Threads.pdf (Size: 1.02 MB / Downloads: 21)
Multithreading
Operating system supports multiple threads of execution
within a single process
1) MS-DOS supports a single thread
2) JRE (Java Run Time) – A single process and multiple threads.
3) UNIX supports multiple user processes but only supports one thread per process
4) Windows, Solaris, Linux, Mach, and OS/2 support multiple threads
Thread
• An execution state (running, ready, etc.)
• Saved thread context when not running
• Has an execution stack
• Some per-thread static storage for local
variables
• Access to the memory and resources of its
process
– all threads of a process share this
Benefits of Threads
• Takes less time to create a new thread than a process
• Less time to terminate a thread than a process
• Less time to switch between two threads within the same
process
• Since threads within the same process share memory and
files, they can communicate with each other without invoking
the kernel