Sie sind auf Seite 1von 10

Multithreading Analysis and its Challanges

MS-CS 3RD SEMESTER

M Shaheryar nawaz |2014-ag-5810


Abstract
The program analysis field has focused basically on sequential programming languages. But in
multithreading it is becoming highly important, both as program structuring of mechanism and
to support most efficient parallel computations. This paper is the review for analysis in
multithreaded programs, majorly focusing on different ways to improve the efficiency of the
analyzing interactions with in threads, or to detect the data races, and to ameliorate impact of
weak memory consistency models. We have identified 2 distinct classes of multithreaded
programs, management programs and also parallel computing programs, and we discuss how these
kinds of programs structure leads to different solutions to the problems. Specifically, we finalize
that the most promising approach for activity management programs are augmented type systems
, while are the most promising approach for parallel computing programs is targeted program
analyses .In this paper analysis of multi threading and advantages or disadvantages of
multithreading and challanges are also discussed.We discussed how the new challenges arised can
create problems in future for the multi threaded programs.

PAGE 1
1. Introduction software. Programmer uses multi threads
to control variety of problems: to build
Computer architects have modified or the responsive servers that can interact at
bring got dramatic gains in performance one time with multiple clients, so to
by using single thread. Each generation parallely run computations on a
of process technology doubles the multiprocessor for good performance,
number of available transistors and, until and structuring mechanism for
recently, these additional resources have implementation of rich user interfaces.
been harnessed toward improving single- Generally, threads are very useful
thread performance Power and memory whenever software needed to manage set
latency considerations place additional of multiple tasks with varying interaction
obstacles to improving single-thread latencies, or to exploit the multiple
performance. Further improvements is physical resources, or execute the largely
limited in overall single-thread .Than independent tasks as in response to
Chip Multi-Threaded (CMT) processors multiple events. . Main challenge is the
support many simultaneous hardware developing efficient methods of
strands (or threads) of execution via a abstractions and the analyses to capture
combination of support for multiple cores the effect of each thread’s actions on the
. SMT increasing latencies by enabling other parallel threads. Multithreading
multiple strands to share many of the also enables many new kinds of errors in
resources within the core, including the programming ; potential severity of all
execution resources. time while waiting these errors and the difficulty of exposing
for off-chip misses to complete spending these errors via testing also has inspired
a significant portion of each strand’s development in analyses that the
utilization of the core’s execution detection of these errors . Most of
resources is extremely low. SMT research in this field has focused
improves the utilization of key resources specially on detecting data races and
and reduces the sensitivity of an researchers also have developed the
application to off-chip misses and optimizations for multithreaded
enables multiple cores to share chip programs; some of these optimizations
resources such as, the memory controller, generalize existing optimizations for
bandwidth for off-chip, and the L2 cache, sequential programs while others are
is also improving the utilization of the specific to multithreaded programs.
resources. In this paper, we describe the Multiprocessor architecture enhance
evolution of CMT processors, the CMT parallel processing of multi-threads. Data
design space and some of the challenges race is a noticeable program in
in designing effective CMT systems. multithreading. Mutex-lock approach
Then to solve the problems of CMP focus reduces the data race problem by giving
is over multithreading approach.[1] the permission with synchronous access
Multithreading is a widely used onshared resources. Deadlock may occur
structuring technique for modern when one tread holds the mutex-lock for

PAGE 2
one process and at the same time other disadvantage is that optimization can
processes are continuously waiting for change the result of the program
that process is due the mutex-lock computes.
approach. In multithreading approach,
the main challenge is to access the shared 2.2. Detection of Data Race
resources without data race and deadlock In unsafe language as C, there are
conditions which is resolved viably number of programming actions that are
through different implementations of always cause the programmer error. If the
multithreading libraries.[2] program engages in these actions, it can
create behavior that is difficult to
understand. Several language design and
2. Use Of Analysis of implementation techniques can
Multithreading completely eradicate these kinds of
errors. Additional cost is overhead and
There are several uses proposed by loss of programmer control other aspects
researchers for using the information of the program execution. For programs
extracted from the analysis of that use threads ,analogous error is data
Multithreaded programs . race, which happens when multiple
threads try to access the same data
2.1 Optimization without any intervening synchronization
Optimizations reorder accesses to the operation, and one of the all accesses is a
shared data in many ways that may be write. A data race is always the result of
observed by concurrently running programming error, with outcome being
threads with transformed thread. To the corruption of accessed data structure.
generalize standard program The mostly used multithreaded languages
representations, analyses, and included , Java, C, and C++, leave the
transformations is used to safely optimize programmer fully responsible for
multithreaded programs even in accesses avoiding data races correctly synchronize
to share data. Presence of multithreading the computation. As a result result uses
is also inspire optimizations with no true of threads is an inherently unsafe
counterpart in the optimization of step by programming practice.
step or sequential programs. An other Researchers developed a set of many
approach is to expect that the analyses to determine if a program may
programmer is correctly synchronize have a data race. Some of analyses allow
program or enable traditional the programmer to find an association
optimizations of compiler within any between data and locks, then find that the
region that does not contain an action or program holds lock whenever it try to
that is designed to mediate the accesses the corresponding data .
interactions between threads . This has
the advantage that eliminates the need to 2.3. Detection of Deadlock
perform a expensive inter thread. The

PAGE 1
Researchers have now developed many To discover program invariants Dataflow
types of analyses for detecting the analysis performs an abstract
potential deadlocks in the programs who interpretation of programs at each
uses rendezvous synchronization .A program point. Conceptually, one can
rendezvous happens between call also view these all analyses as a
statement of one thread and of accept propagating information along with
statement in another thread. The analyses control-flow paths, and as an approach to
also match corresponding calls and then work reasonably as well for the
accepts to determine if every call will sequential programs in the part because
participate in rendezvous. If not, then as each statement has less direct control-
program is considered to be deadlock. We flow successors.
find that deadlock arises from the
circular waiting to acquire the required The straight forward approach to
resources, and is a major problem in multithreaded programs to propagate all
multithreaded programs. In this way , information between statements of
programs typically use the mutual parallel threads. The main issue is that
exclusion method of synchronization direct control-flow in successors of
than the rendezvous synchronization. We statement in one of thread include the
expect an analysis of deadlock detection most if all of statements is not in all
for programs that uses mutual exclusion parallel threads. Propagating the
method of synchronization to obtain information along all of the potential
partial order for the acquired resources control-flow of edges leads to algorithm
and then check that the program always with intractable execution of times. How
follow this order. The order could also to reduce the numbers of paths that
obtained from the programmer or may be analysis must be explicitly consider.
extracted automatically from analysis of 3.2 Control-Flow Analysis
program.[3][1]
One approach to analyze the program is
use of synchronization constructs for the
purpose to discover regions of all tasks
3 .Analysis Algorithms
that are not executed concurrently, or
Some of main issues that are arises when then to remove the edges between all
we apply standard approaches for the these regions. The main characteristics of
purpose of analyzing multithreaded the analysis is to depend on specific
programs. We are focusing on many ways synchronization of constructs.
to improve efficiency of analyzing the Researchers also have developed the
interactions between multiple types of algorithms for all programs that use post
threads. and wait constructs or used in parallel
dialects , for rendezvous constructs and
3.1 Dataflow Analysis of for Java wait or notify constructs The
Multithreaded Programs basic idea algorithms to match each of

PAGE 2
blocking action with its all potential threads that can access the same data, the
corresponding to trigger the actions of presence of the references may also
other threads. The analysis also uses the significantly complicate determination
information to find that statements must by which instructions can interact with
execute before the trigger action or the other threads. One approach is by
before the statements that block action. interleave pointer analysis with analysis
Generally the algorithms constructed for that also determines instructions that also
post and wait are design to work with in interact with other thread , or another
the parallel loops that accesses the dense approach would use results of an old
matrices. These programs uses post and efficient pointer analysis just to find these
wait constructs to ensure that write in an instructions .[9]s
array element in parallel loop iteration
precedes the reads to the same element in 3.4 Interference-Based Analyses
other iterations. The techniques therefore This analyses maximally coarsen analysis
focus on correlating the array accesses granularity — they also analyze that each
with corresponding post and wait thread as unit to compute result that
constructs that order them. The characterizes all interactions with the
algorithms for rendezvous and Java wait other threads. The analysis information
or notify constructs tend to more that is extracted then flows from each
effective for the programs in which thread end to beginning of all other
threads execute different in code, also parallel threads. For just standard bit
enable the analysis and distinguish vector analyses as live variables and
between threads at code level that thread reaching definitions, this approach is
executes. We expect that algorithms are somewhat delivers an efficient algorithm
less effective for server programs in with same precision as algorithm that
which most of threads execute in same explicitly analyzes all the possible inter
code.[6] leavings . For many more complicated
3.3 Coarsening The Analysis analyses as pointer analysis, existing
Granularity algorithms also based on this approach of
overestimating the effects of potential
Way to reduce the analysis time by interaction between threads and the lose
collecting adjacent instructions from all precision. In the end , if language
threads into large groups, then treat each semantics rules out that the possibility
of the group as unit in the inter thread interact between tasks, or analyzing each
analysis . To collect instructions that do task as a single unit seems as obviously
not actually interact with the other the right way to proceed.[8]
threads; so this case show that resulting
coarsening analysis granularity do not 3.5 Flow-Insensitive Analyses
affect precision of final analysis result. Unlike the dataflow analyses, flow-
Because as relevant interactions take insensitive analyses can produce same
place at the instructions of different result or regardless of order in which

PAGE 3
statements appear in program or number conversations in separate
of times they executed . Therefore threads in some programs than
trivially extend for handling the to manage them from the same
multithreading programs. The analysis thread.
results can then be used directly or a
 Multiple_applications can be
foundation to increase the effectiveness
simultaneously accesed
of detailed flow-sensitive analyses.[3]
At a time your clients can be
connected to more than one
4. Advantages and disadvantages application
Of Multi threading  Servers are required in reduced
number
Multithreading and multi contexting are
powerful tools for increasing the
Because multiple service
performance of BEA Tuxedo
threads can dispatch by one
applications-given the appropriate
server , then the number of
circumstances., however, it is very
servers required to start your
important to understand potential
application reduced. For
benefits and disadvantages as wells.
multiple dispatched threads this
capability is especially useful
4.1 Advantages of a Multithreading specially for conversational
Multithreading offer the following servers, which must be
advantages: dedicated otherwise to one
client for purpose of
 Improved performance and conversation for entire
concurrency duration.[5]

By using multithreading 4.2 Disadvantages of a Multithreading


performance and concurrency
Multithreading present the following
for certain applications can be
disadvantages:
improved . Performance could
be unaffected or even degraded Writing code is difficult
In many applications by using
It is not easy to write
multithreading. It depends on
Multithreaded applications .
your application that how
Only experienced programmers
performance is effected.[4]
should code for these
applications.
 For conversations and remote
procedure calls it simplified
 Debugging is difficult
coding
It is harder to replicate any error
It is easy to code in different
in multithreaded application
remote procedure calls and

PAGE 4
than it can be do in a single- 5. Challenges
threaded program . So it is find
more difficult, in this case, to  Primary challenges to analyze
verify and identify main causes multithreaded programs is remain
when errors occur. a developing abstraction and
analyses can precisely
 Difficulty in managing
characterizes interactions
concurrency
between the threads. For
Managing concurrency task explicitly interactions take place
among threads is very difficult at the synchronization constructs,
and has potential to introduce primary goal just to match the
some new problems into the interacting pairs to constructs.[7]
application.  For implicit kind of interactions
that happens at memory locations
 Difficulty in testing accessed only by multiple threads,
primary goal to find instructions
Testing the multithreaded
that access same memory
application is difficult than
testing of a single-threaded locations, then characterizes
application because its defects combined effects of the
are timing-related and more instructions. The use of dynamic
difficult in reproducing. memory allocation, object
references, and arrays
 Difficulty in port existing code significantly complicates the
analysis of these implicit
Significant re-architecting in interactions because they force
existing code is often requires to the analysis to disambiguate the
take the advantage of
accesses to avoid analyzing
multithreading. Programmers
need to: interactions that never occur
when the program runs.
o Remove the static  The problem is for programs that
variables use referencing because
o Replace any of function to interactions in instructions that
calls that are just not access references in turn, affect
thread-safe the location that other instructions
o Replace any of other code accesses. Main challenges is to
that is also not the thread-
develop efficient method of
safe
disambiguation analyses for the
Testing and re-testing should be multithreaded programs..
completed for port,as to port a  Most of existing analyses
multithreaded application is assumes that a simple model of
substantial the work is required. multithreaded execution is

PAGE 5
characterized by absence of one Khorrami, “Anomaly Detection in
and many of dynamic object Real-Time Multi-Threaded Processes
Using Hardware Performance
creation, dynamic thread creation,
Counters,” IEEE Trans. Inf.
references to objects , and Forensics Secur., vol. PP, no. c, pp.
procedure or method calls. [3] 1–1, 2019.
[4] I. The and I. L. Parallelism, “Multi-
threading technology and the
challenges of meeting performance
6. Conclusion and power consumption demands for
mobile applications,” no. September,
Multithreaded programs are more pp. 1–9, 2013.
complicated for analyzing than the
[5] L. Yin, W. Dong, W. Liu, and J.
sequential programs. Many analyses also Wang, “Parallel Refinement for
have focused on characterizing the Multi-Threaded Program
interactions between multiple threads to Verification,” 2019 IEEE/ACM 41st
detect the safety problems as data races Int. Conf. Softw. Eng., pp. 643–653,
and the deadlock or to hide errors 2019.
associated with weak models of memory [6] F. N. Eskesen, M. Hack, T. Kimbrel,
consistency. Future more directions M. S. Squillante, R. J. Eickemeyer,
include generalizing the abstractions and and S. R. Kunkel, “Performance
Analysis of Simultaneous
analyses to make better handle constructs Multithreading in a PowerPC-based
such as dynamically also allocated Processor,” Proc. 1st Annu. Work.
memory, dynamic method of thread Duplic. Deconstructing, Debunking
creation, procedures or methods, and (WDDD 2002), 2002.
threads as first-class objects. We also
anticipate that the further more
[7] V. Kelefouras and K. Djemame,
development of augmented type of
“Workflow Simulation Aware and
systems for race-free programs, in which Multi-threading Effective Task
it will reduce the potential inter thread Scheduling for Heterogeneous
interactions that analysis should consider Computing,” Proc. - 25th IEEE Int.
and enable development and use more Conf. High Perform. Comput. HiPC
2018, pp. 215–224, 2019.
detailed through precise analyses.
[8] M. Zhang, Z. Zhang, Y. Dai, Q.
7. References: Wang, W. Sun, and X. Hu, “Design of
a Multi-Threaded Positioning System
[1] X. Huang, Z. Liu, and J. Li, “Array Software Architecture for Ground
sort: an adaptive sorting algorithm on Mobile Robots,” Proc. - 2018 5th Int.
multi-thread,” J. Eng., vol. 2019, no. Conf. Inf. Sci. Control Eng. ICISCE
5, pp. 3455–3459, 2019. 2018, no. 1, pp. 699–703, 2019.
[2] M. Rinard, “Analysis of [9] 宋争辉, “No Title专业外语有屁用,”
multithreaded programs,” Lect. Notes
Comput. Sci., pp. 1–19, 2001. 信阳师范学院, vol. 10, no. 2, pp. 1–
15, 2018.
[3] P. Krishnamurthy, R. Karri, and F.

PAGE 6
PAGE 7

Das könnte Ihnen auch gefallen