Unit 3
Unit 3
Programming Manjrasoft
IBM Power Systems
1
Unit Objectives Manjrasoft
IBM Power Systems
6
Parallelism for single machine computation
Contd… Manjrasoft
IBM Power Systems
• Multicore systems are composed of a
single processor that features multiple To Memory
processing cores that share the memory.
• Each core has generally its own L1 cache,
and the L2 cache is common to all the CPU: single
cores, which connect to it by means of a die
shared bus.
• Dual- and quad-core configurations are Cache L2
quite popular nowadays and constitute the
standard hardware configuration for
commodity computers.
• Architectures with multiple cores are also
available but are not designed for the
commodity market. Cache L1 Cache L1 Cache L1
• Multicore technology has been used not
only as a support for processor design but
also in other devices, such as GPUs and Core 1 Core 2 Core N
network devices, thus becoming a
standard practice for improving
performance.
7
Parallelism for single machine computation
Contd… Manjrasoft
IBM Power Systems
9
Programming Applications with Threads Manjrasoft
IBM Power Systems
10
What is a Thread? Manjrasoft
IBM Power Systems
Process
Shared Memory
Main Thread
Execution
Timeline
Instructions
(program counter)
Thread
Thread
Thread
13
Thread APIs Manjrasoft
IBM Power Systems
14
POSIX Threads Manjrasoft
IBM Power Systems
15
POSIX Threads contd… Manjrasoft
IBM Power Systems
16
Threading Support in java and .NET Manjrasoft
IBM Power Systems
17
Threading Support in Java and .NET contd… Manjrasoft
IBM Power Systems
• Both Java and .NET express the thread abstraction with the class Thread
exposing the common operations performed on threads: start, stop,
suspend, resume, abort, sleep, join, and interrupt.
• Start and stop/abort are used to control the lifetime of the thread instance,
while suspend and resume are used to programmatically pause, and then
continue the execution of a thread.
• These two operations are generally deprecated in both of the two
implementations that favor the use of appropriate techniques involving
proper locks of the use of sleep operation.
• This operation allows pausing the execution of a thread for a predefined
period of time.
• This one is different from the join operation that makes one thread wait until
another thread is completed.
• These waiting states can be interrupted by using the interrupt operation
which resumes the execution of the thread and generates an exception
within the code of the thread to notify the abnormal resumption.
18
Threading Support in Java and .NET contd… Manjrasoft
IBM Power Systems
19
Techniques for Parallel Computation with
Threads Manjrasoft
IBM Power Systems
20
Multithreading with Aneka Manjrasoft
IBM Power Systems
21
Multithreading with Aneka Contd… Manjrasoft
IBM Power Systems
22
Multithreading with Aneka Contd… Manjrasoft
IBM Power Systems
24
Introducing thread Programming model Contd… Manjrasoft
IBM Power Systems
25
Introducing thread Programming model Contd… Manjrasoft
IBM Power Systems
26
Introducing thread Programming model Contd… Manjrasoft
IBM Power Systems
• Application:
– This class represents the interface to the Aneka middleware and constitutes a local view of a
distributed application.
– In case of the Thread Programming Model the single units of work are created by the
programmer. Therefore, the specific class used will be Aneka.Entity.AnekaApplication<T,M>
with T and M properly selected.
• Threads
– Threads represent the main abstractions of the model and constitute the building blocks of
the distributed application.
– Aneka provides the Aneka.Threading.AnekaThread class, which represents a distributed
thread. This class exposes a subset of the methods exposed by the
System.Threading.Thread class, which has been reduced to those operations and properties
that make sense, or can be efficiently implemented in a distributed context.
• Thread Manager
– This is an internal component that is used to keep track of the execution of distributed
threads and provide feedback to the application.
– Aneka provides a specific version of the manager for this model, which is implemented in the
Aneka.Threading.ThreadManager class.
27
Introducing thread Programming model Contd… Manjrasoft
IBM Power Systems
29
Aneka Threads Application Model Manjrasoft
IBM Power Systems
31