ArchViMP

Architectural Views for Multithreaded Programs

a Framework for Automatic Extraction of Concurrency-related Architectural Properties from Software

Keywords: Concurrent programming, Multithreading programming, Architectural abstraction, Architectural views, concurrency properties visualization

© Supported by the research institutes Fraunhofer IESE and DFKI-IFS

ArchViMP Overview Structure

Figure 1 show the overview structure of ArchViMP framework where the interaction of the framework with external systems is depicted.

Figure 1: The overview of ArchViMP framework structure

ArchViMP Inputs

We receive three text files as the input for our framework. In below we clarify the format of each.

1- The list of the shared variables

This is provided by the previous work (See Figure 2), which is based on using the Eraser Lockset algorithm In below there is the list of shared variables of ROSACE benchmark as an example.


variable name,Address of memory,Data type;
395293680,{395293680},INT;CONSTANT;
step_simu,{394729264},INT;CONSTANT;
tasks,{394729520},POINTER;POINTER;
max_step_simu,{394729552},INT;CONSTANT;
h_c,{393974944},DOUBLE;CONSTANT;
Vz_control_50483_delta_e_c_delta_e_c,{394798512},DOUBLE;CONSTANT;

Eraser Lockset a Eraser Lockset b
Figure 2: a) Eraser Lockset memory state model; b) Data structures necessary for Lockset

2- Execution trace data

This file is a detailed list of the executed instructions. In the box below a small part of the file is displayed. In below you see the execution trace data of ROSACE benchmark as an example.


Timestamp,ThreadID,Operation,ParameterName (function or a variable name),Address of memory,Additional info (data typeof variable),Value,filename,source code line number
11.19.58.1958,6245422,FUNCTIONCALL,main,0,,,,0
11:19:58:429,6245422,STORE,,46648696,INT;LOCAL;,0,,0
11:19:58:429,6245422,STORE,tsimu,46649000,INT;LOCAL;,20,rosace.c,10
11:19:58:429,6245422,LOAD,tsimu,46649000,INT;LOCAL;,20,rosace.c,14
11:19:58:429,6245422,LOAD,,0,INT;,20,rosace.c,14
11:19:58:429,6245422,FUNCTIONCALL,run_rosace,0,INT;CONSTANT;,,rosace.c,14
...
11:19:58:636,20176314,STORE,,46648968,INT;LOCAL;,1,assemblage.c,145
11:19:58:636,20176314,GETELEMENTPTR,,46648972,POINTER;LOCAL;,0x2c7ce8c,assemblage.c,145
11:19:58:636,20176314,STORE,,46648972,INT;LOCAL;,0,assemblage.c,145
11:19:58:636,20176314,GETELEMENTPTR,,46648968,POINTER;LOCAL;,0x2c7ce88,assemblage.c,145
11:19:58:636,20176314,STORE,,395332088,POINTER;LOCAL;,0x2c7ce88,assemblage.c,145
11:19:58:636,20176314,GETELEMENTPTR,struct.write_proto_t,395332092,POINTER;LOCAL;,0x179049fc,assemblage.c,145
11:19:58:640,20176314,STORE,,395332092,INT;LOCAL;,2,assemblage.c,145
...

3- Execution path logs (coverage)

This input includes several blocks of information (see Figure 3).
  • The outer block specified with the “Variable” keyword. Each variable blockcontains information about the operations and accesses that have been doneon a variable.
  • The first inner block with the keyword “Thread” defines the threads thataccessed that variable via a entry point function.
  • The next inner block with the keyword “Function” determines within whichnested function that variable is accessed.
  • The access of a shared variable within a logical decision is specified in the innerblock identified with “logicalDecision” keyword. This information follows thesame format of records in the trace input.

Execution path logs
Figure 3: Format of execution path logs

Architectural Notations for Concurrency-related Properties

To represent concurrency-related architectural properties of software, we adopt the UML (Unified Modelling Language) 2.0 notations ( The elements of UML (TM) 2.0 style ).

Primarily, we reuse the views-specific notations from Embedded Modelling Profile (EMP) , which is an extension to SPES 2020 . In addition, we use the UML block notation from APD introduced in a Pattern-supported Parallelization Approach to show threads and their groups. In order to distinguish a box of elements, we utilize EMP's idea of semantic separation of boxes through a static set of colors and dedicated stereotypes. Moreover, we expand the in/out notation of the block notation from APD and introduce four flags to specify the three access operation types for all elements and to clarify the shared variables that are only used inside a logical decision by a Condition Only flag. Table 1 in below contains the detailed description of the notations.

ArchViMP Notation Description
Table 1: ArchViMP Notation Description

Evaluation

To evaluate our work, we have publicly available benchmarks of parallel and concurrent programs based on POSIX threads. In order to test our approach on software with a complexity that resembles that present in industrial software, we focused on two publicly available benchmarks.

In addition to these two benchmarks, we developed our own benchmark, called ThreadCreator, to mimic the behavior of industrial software as well as to cover the corner cases we mentioned in the paper Section 3.4.
We counted the actual number of technical elements for each benchmarks (Table 2).

Table 2: Actual number of technical elements of benchmarks
ROSACE TACLeBench
powerwindow
ThreadCreator
Number of threads (technical components of software) 6 4 10
Number of shared variables (technical data of software) 6 7 19

Results

When applied on these three benchmarks, our approach produced diagrams at all three levels of abstraction. At level 0, it produced the raw visualization of the execution traces, showing the direct interaction between threads and shared variables. Level 1 of the abstraction illustrates the members (either technical or logical) of each set of logical data as well as the operation access types applied to each member by the threads. At abstraction level 2, we show the interconnection of logical components and logical data. In the following, we show the results for each benchmark individually.

ROSACE Benchmark

ROSACE Raw visualization at abstraction level 0

This visualization shows the direct interaction between threads over shared variables with no-abstraction.

Raw visualization ROSACE Benchmark

Functional Concurrency View

The functional concurrency view describes the functional behavior of threads. This view shows the interaction between a logical component created by EPFR rule and logical data

Functional Flow sub-view

ROSACE Functional Flow sub-view at level 2
Functional Flow sub-view at level 2 - created by EPFR and CFR rules

ROSACE Functional Flow sub-view at level 1
Functional Flow sub-view at level 1 - created by CFR, FOR and possibly DSR rules

Even after abstraction interpretation of interaction between elements might be challenging. Therefore, we made the understanding of views easier by providing an interactive interaction between sub-views. ROSACE Functional Flow sub-view at level 1
Functional Flow sub-view at level 1 - function run_rosace() is selected by user

Execution Control Flow sub-view

ROSACE Execution Control Flow sub-view at level 2
Execution Control Flow sub-view at level 2 - created by EPFR, LDR rules

ROSACE Execution Control Flow sub-view at level 1
Execution Control Flow sub-view at level 1 - created by LDR, LDOR and possibly DSR rules

Technical Concurrency View
Diagrams in this view are depicted at the abstraction level 1, which represent the technical members of the logical groups.
1- Logical Components - created by EPFR rule: Threads are technical components of a piece of software. The below diagram shows threads are grouped by EPFR rule into logical components.

ROSACE result of EPFR rule
Technical concurrency view at level 1 - created by EPFR rule

2- Data Types - Created by DTR rule: This diagrams only shows the data types of the shared variables.
ROSACE result of DTR rule
ROSACE result of DTR rule
ROSACE result of DTR rule
3- Logical data - created by DSR rule: The DSR rule groups the shared variables that, are members of a data structure, into a set of logical data. For ROSACE benchmark, no data structures were found.

result of DSR rule

Evaluation Parameters in Functional Concurrency View
Table 3: ROSACE benchmark - Evaluation Parameters
ROSACE Raw visualization Functional Concurrency View
Functional Flow
sub-view
Execution Control Flow
sub-view
Highest Abstraction Level Level 0 Level 2 Level 2
Number of Elements (Nodes/Boxes) 12 6 4
Number of Relations (Edges/Lines) 24 4 2
Element Reduction Percentage - 41% 66.7%
Relation Reduction Percentage - 87% 92%

TACLeBench - powerwindow Benchmark

powerwindow Raw visualization at abstraction level 0

This visualization shows the direct interaction between threads over shared variables with no-abstraction.

Raw visualization powerwindow Benchmark

Logical Concurrency View

For this benchmark we obtained logical concurrency view, where the direct interaction between threads over shared memory is depicted at level 3 of abstraction. This group of threads in view is created by EPFR rule and shared variables are grouped by TOR and TASR rules.

Functional concurrency view

Functional Flow sub-view

Execution Control Flow sub-view

Technical concurrency view

1- Logical Components

2- Data Type

3- Logical Data

TACLeBench - powerwindow Evaluation Parameters
Table 4: TACLeBench - powerwindow benchmark - Evaluation Parameters
TACLeBench - powerwindow Raw visualization Functional Concurrency View Logical Concurrency View
Functional Flow
sub-view
Execution Control Flow
sub-view
Highest Abstraction Level Level 0 Level 2 - Level 3
Number of Elements (Nodes/Boxes) 11 4 - 6
Number of Relations (Edges/Lines) 10 0 - 4
Element Reduction Percentage - 63.6% - 45%
Relation Reduction Percentage - - - 60%

ThreadCreator Benchmark

ThreadCreator Raw visualization at abstraction level 0

This visualization shows the direct interaction between threads over shared variables with no-abstraction.

Raw visualization ThreadCreator Benchmark

Functional concurrency view

Functional Flow sub-view

Functional Flow sub-view at Level 2

Functional Flow sub-view at Level 1

Execution Control Flow sub-view

Execution Control Flow sub-view at Level 2

Execution Control Flow sub-view at Level 1

Technical concurrency view

1- Logical Components

2- Data Type

3- Logical Data

Evaluation Parameters in Functional Concurrency View
Table 5: ThreadCreator benchmark - Evaluation Parameters
ThreadCreator Raw visualization Functional Concurrency View
Functional Flow
sub-view
Execution Control Flow
sub-view
Highest Abstraction Level Level 0 Level 2 Level 2
Number of Elements (Nodes/Boxes) 29 14 12
Number of Relations (Edges/Lines) 113 13 9
Element Reduction Percentage - 51.7% 59%
Relation Reduction Percentage - 89% 92%