Professional Documents
Culture Documents
Hreads: Program Counter: Registers
Hreads: Program Counter: Registers
Hreads: Program Counter: Registers
Parallel execution on a
multicore system
TYPES OF PARALLELISM
Data parallelism : divides the data up amongst
multiple cores ( threads ), and performs the same
task on each subset of the data. E.g. summing
array size N.on dual core sum[0]….[N/2-1] 2nd
core sum [N/2]….[N-1]
Task parallelism: divides the different tasks to
be performed among the different cores and
performs them simultaneously.
USER MODE AND KERNEL MODE
When a computer system is executing on behalf
of user application, it is user mode.
Mode bit=1
ƒPOSIX Pthreads,
Mach C-threads,
Solaris 2 UI-threads
Advantages
Advantage
ƒ
Many user-level threads to one kernel thread
ƒ
Advantage:
ƒ
Thread management is handled by the thread
library in user space, which is very efficient.
ƒ
Disadvantage:
ƒ
One blocking system call blocks all.
ƒ
Because a single kernel thread can operate only
on a single CPU, the many-to-one model does not
allow individual processes to be split across
multiple CPUs.
ƒ
Example: Green threads for Solaris 2
Many-to-one model
ONE-TO-ONE MODEL
ƒ
One user-level thread to one kernel thread
ƒAdvantage: One system call blocks one thread
and the splitting of processes across multiple
CPUs
ƒDisadvantage: Overheads in creating a kernel
thread.
ƒExample: Windows NT, Windows
2000, OS/2
One-to-One Model
MANY-TO-MANY MODEL
ƒ
Many user-level threads to many kernel threads
combining the best features of the one-to-one and
many-to-one models
ƒAdvantage:
Users have no restrictions on the number of
threads created.
Blocking kernel system calls do not block the entire
process.
Processes can be split across multiple processors
ƒExample: Solaris 2, IRIX, HP-UX,Tru64 UNIX
Many-to-Many Model
Two-level Model
Similar to previous Many to
Many,
except that it
allows a user thread to
bound to a kernel thread
Examples
IRIX
HP-UX
Tru64 UNIX
Solaris 8 and