17-08-2012, 12:16 PM
Threads, SMP, and Microkernels
1Threads.pdf (Size: 1.72 MB / Downloads: 416)
Unit of resource ownership
process is allocated a virtual address space to hold
the process image
Unit of dispatching
scheduled and dispatched by the OS
execution may be interleaved with other processes
These two characteristics are treated
independently by today’s operating system
Multithreading
Refers to the ability of an OS to support
multiple threads of execution within a
single process
MS-DOS supports a single user process
and a single thread
UNIX supports multiple user processes
but only supports one thread per process
Windows 2000, Solaris, Linux, Mach, and
OS/2 support multiple threads
Processes in Multithreaded
environment
A process is the unit of resource allocation
and a unit of protection
have a virtual address space that holds the
process image
protected access to processors, other
processes, files, and I/O resources
Per Process Items
address space, global variable, open files, child
processes, timers, signals, semaphores, account
Threads
Within a process, there may be one or
more threads, each with the followings
thread execution state(running, ready,...)
saved thread context
program counter, stack, register set, child threads,
memory 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
no need to allocate a virtual address space
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
Threads
Actions that affect all of the threads in a
process
Suspending a process involves suspending all
threads of the process since all threads share
the same address space
Termination of a process terminates all
threads within that process